1.1.4 • Published 15 days ago
@astram/node-helper v1.1.4
Astram Node Helper
All Common Helper Functions will be used using this library
Installation
Install node-helper using npm
$ cd <working_directory>
$ npm i @astram/node-helper
Helper Modules
S3 Module
This module is used to get all tasks related to S3 that includes following functionality
- Upload Files
- uploadToS3
- Directly Upload File from local system/server to S3
- uploadFromBuffer
- Upload data/content to a file onto S3
- uploadFromStream
- Upload using stream
- uploadToS3
- Get File
- getAllFiles
- Get all files of a folder
- getFileLink
- Get File as URL from S3 which is signed and will expires by default it is 5mins
- downloadFromS3
- Download File from S3 to local system or get content of file
- getAllFiles
- Check File Existance
- isFileExist
- Check whether a file exists corresponding to a bucket or not
- isFileExist
- Delete File
- deleteFile
- Delete file from S3
- deleteFile
Code Example
const { s3 } = require(`@astram/node-helper`);
const bucket = `astram-bucket`;
// check if file exists
const filePath = `test/test.pdf`;
const isFile = await s3.isFileExist(bucket, filePath);
// Get File Link
const filePath = `test/test.pdf`;
const isFile = await s3.getFileLink(bucket, filePath);
...