macuploader
v1.2.9
Published
A easy to use file uploader.
Downloads
7
Maintainers
Readme
Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
If this is a brand new project, make sure to create a package.json
first with
the npm init
command.
Installation is done using the
npm install
command:
Examples
Check Server Status
const status = await module.online("...url");
console.log(status); // true or false
Upload File
const file = await module.upload(stream, { server: "...url", token: "...apiToken", name: "...fileName" });
console.log(file); // returns file key in JSON object
Download File
const download = await module.download("..url");
const dest = fs.createWriteStream("...filePath");
download.pipe(dest);
download.on("end", () => {
// When the file finishes downloading.
});