npm.io
1.2.27 • Published 1 year ago

@astram/node-helper

Licence
ISC
Version
1.2.27
Deps
8
Size
1.4 MB
Vulns
2
Weekly
0

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
  • 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
  • Check File Existance
    • isFileExist
      • Check whether a file exists corresponding to a bucket or not
  • Delete File
    • deleteFile
      • Delete file from S3
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);

...