npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mds-file-upload

v1.0.1

Published

A simple and efficient file upload utility for Node.js applications, supporting temporary and permanent storage.

Downloads

116

Readme

mds-file-upload

mds-file-upload is a simple and efficient file upload utility built for Node.js applications. It supports uploading files to a specified folder and managing temporary and permanent storage paths with ease.


Features

  • Upload files to a specified folder.
  • Temporary file storage option.
  • Move files from temporary to permanent storage.
  • Delete uploaded files.
  • Check for the existence of files or folders.

Installation

To install the package, run:

npm install mds-file-upload

Usage

Importing and Initialization

Import the MdsFileUpload class and initialize it with your project's base directory:

import { MdsFileUpload } from "mds-file-upload";

const uploader = new MdsFileUpload(process.cwd());

Methods

1. handleFileUpload

Uploads a file to the uploads folder by default or to the temp folder if specified.

Parameters:

  • infile (File): The file to upload.
  • toTemp (boolean, optional): Whether to upload to the temporary folder. Defaults to false.

Example:

const file = new File(["content"], "example.txt");

uploader.handleFileUpload(file)
  .then(result => console.log("File uploaded:", result))
  .catch(err => console.error("Upload failed:", err));

2. deleteUploadedFile

Deletes a file from the uploads folder.

Parameters:

  • filename (string): The name of the file to delete.

Example:

uploader.deleteUploadedFile("example.txt")
  .then(() => console.log("File deleted."))
  .catch(err => console.error("Deletion failed:", err));

3. moveFileToUpload

Moves a file from the temp folder to the uploads folder.

Parameters:

  • filename (string): The name of the file to move.

Example:

uploader.moveFileToUpload("temp-example.txt")
  .then(success => console.log("File moved successfully:", success))
  .catch(err => console.error("Move failed:", err));

4. checkFileOrFolderExists

Checks if a file or folder exists at a specified path.

Parameters:

  • targetPath (string): The path to check.

Example:

uploader.checkFileOrFolderExists("/path/to/file.txt")
  .then(exists => console.log("Exists:", exists))
  .catch(err => console.error("Error checking existence:", err));

File Structure

mds-file-upload/
├── src/
│   ├── index.ts       # Main source file
├── dist/              # Compiled output
├── package.json       # NPM configuration
├── README.md          # Project documentation
└── tsconfig.json      # TypeScript configuration

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a Pull Request.

License

This project is licensed under the MIT License.


Author

Developed and maintained by Mwero Abdalla.


Repository

The source code for this project is available on GitHub:

https://github.com/mwenaro/mds-file-upload


Versioning

This package follows semantic versioning. Refer to the CHANGELOG for details on updates.