New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gridstorage

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gridstorage

GridFS + Mongoose helper

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

gridstorage

GridFS + Mongoose helper

Installation

npm i gridstorage

API

new Storage(mongodb) : Storage

const Storage = require('gridstorage');
const mongo = require('mongodb');
const { MongoClient } = mongodb

MongoClient.connect(uri, (err, db) => {
  if (err) {
    throw new Error(err);
  }
  const storage = new Storage(mongo, db);

To use with Mongoose:

new Storage(mongoose) : Storage

const Storage = require('gridstorage');
const mongoose = require('mongoose');

const storage = new Storage(mongoose);

Storage.bucket(bucketName) : Bucket

const videoBucket = storage.bucket('videos');

Bucket.count(filename) : Promise –> Number

if (await videoBucket.count(filename) > 0) {
  return next('Video exists');
}

Bucket.find(...args) : Promise –> Cursor

Bucket.download(filename, options) : GridFSBucketReadStream

Bucket.downloadById(id, options) : GridFSBucketReadStream

Bucket.upload(filename, metadata) : GridFSBucketWriteStream

Bucket.rename(id, filename, callback) : Promise

Bucket.delete(id, callback) : Promise

Keywords

gridfs

FAQs

Package last updated on 23 Sep 2018

Did you know?

Socket

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.

Install

Related posts