1.0.2 • Published 2 years ago
sazumifile
Licence
ISC
Version
1.0.2
Deps
2
Size
2 kB
Vulns
0
Weekly
0
upload-file Module
This module allows you to easily upload files to an external server using Node.js. The module utilizes Axios, FormData, and fs libraries to perform file uploads.
Installation
To use this module, you need to install it via npm.
npm install sazumifile
Usage
Here's how to use the module in a Node.js application:
Import the uploadFile module:
const { uploadFile } = require('sazumifile');
Call the uploadFile function with the path to the file you want to upload:
const filePath = 'path/to/your/file.txt';
uploadFile(filePath)
.then((url) => {
console.log(`File uploaded successfully. URL: ${url}`);
})
.catch((error) => {
console.error(`Failed to upload file: ${error.message}`);
});
Make sure to replace 'path/to/your/file.txt' with the actual path to the file you want to upload.