@sproutasia/sprout-filesystem-api
v1.0.6
Published
Sprout's interface with filesystem
Downloads
1
Keywords
Readme
Simplified Filesystem function for Sprout Apps
Key features
- MongoDB GridFS integration
- Get File
- Upload File
- Delete File
Installation
1.Install package
To install sprout-basis-api with npm
:
npm install @sproutasia/sprout-filesystem-api --save
To install sprout-basis-api with yarn
:
yarn add @sproutasia/sprout-filesystem-api --save
Usage
Here is a basic example of using sprout-filesystem-api within a nodejs application.
const SproutFilesystem = require("@sproutasia/sprout-filesystem-api");
const filesystemAPI = new SproutFilesystem("<TypeGoesHere>", {
/*Options goes here*/
});
// Get File
filesystemAPI.download("<PasteFileIDHere>");
// Upload File
const file = fs.createReadStream("./toBeUploadedFile");
filesystemAPI.upload(file);
// delete File
filesystemAPI.delete("<PasteFileIDHere>");