Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
grid-filestorage
Advanced tools
Simple GridFS filestorage with simple API
npm i --save grid-filestorage
const fs = require('fs');
const path = require('path');
const FileStorage = require('grid-filestorage');
const filestorage = new FileStorage(db, { title: 'Test' });
// db — is the native db connection to mongodb
// options.title — title of storage, optional. Title prepend with "-" before filename
const filestream = fs.createReadStream(path.join(__dirname, './test.png'));
const filename = 'testfile';
const meta = {
"content_type": 'image/png'
}
filestorage.write(filestream, filename, meta).
then(filename => console.info(`file ${filename} in storage`));
// file Test-testfile in storage
// ...
const mongoose = require('mongoose');
const FileStorage = require('grid-filestorage');
const filestorage = new FileStorage(mongoose.connection.db);
// ...
This mehod streams stream
into GridFS with filename
and meta
stream
— Readable streamfilename
— name of file, optional. If filename does not exist, filestorage will auto-generate itmeta
— meta information about file for GridFS, optional{
content_type: 'image/png',
metadata:{
author: 'Daniel'
},
chunk_size: 1024 * 4
}
This method read file from GridFS by filename
filename
— name of file to read. If filestorage has title, filename must exclude title + '-'
partisExists
— if this flag is true, method will check file before readThis method remove file from GridFS by filename
filename
— name of file to remove. If filestorage has title, filename must exclude title + '-'
partisExists
— if this flag is true, method will check file before removeFileStorageError
— File does not exist
, if file does not exist into GridFSFAQs
File storage module to save files into gridfs
The npm package grid-filestorage receives a total of 3 weekly downloads. As such, grid-filestorage popularity was classified as not popular.
We found that grid-filestorage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.