Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fi-gridfs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fi-gridfs - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

34

lib/index.js

@@ -62,3 +62,2 @@ 'use strict';

var Grid = new GridFS(this.db);
var source = arguments[0];

@@ -71,3 +70,3 @@

return new Promise((resolve, reject) => {
var ws = Grid.createWriteStream(options);
var ws = (new GridFS(this.db)).createWriteStream(options);

@@ -112,6 +111,2 @@ ws.once('close', (fsfile) => {

read(selector, callback) {
var Grid = new GridFS(this.db);
var query = {};
var _id;
/* Check for callback function */

@@ -123,4 +118,8 @@ if (is.not.function(callback)) {

return new Promise((resolve, reject) => {
var grid = new GridFS(this.db);
var query = {};
var _id;
/* Check if the filter is an ObjectID, filename or something else */
_id = Grid.tryParseObjectId(selector);
_id = grid.tryParseObjectId(selector);

@@ -139,3 +138,3 @@ if (_id) {

/* Fetch the file information if any */
Grid.collection().findOne(query, (err, fsfile) => {
grid.collection().findOne(query, (err, fsfile) => {
if (err) {

@@ -158,3 +157,3 @@ callback(err);

/* Check if the file data exists */
Grid.exist(query, (err, found) => {
grid.exist(query, (err, found) => {
if (err) {

@@ -177,3 +176,3 @@ callback(err);

/* Return the file information and the read stream */
fsfile.stream = Grid.createReadStream(query);
fsfile.stream = grid.createReadStream(query);

@@ -194,6 +193,2 @@ callback(null, fsfile, fsfile.stream);

remove(param, callback) {
var Grid = new GridFS(this.db);
var options = {};
var _id;
/* Check for callback function */

@@ -205,3 +200,4 @@ if (is.not.function(callback)) {

return new Promise((resolve, reject) => {
var err;
var options = {};
var _id, err;

@@ -217,4 +213,6 @@ if (is.not.string(param) && is.not.object(param)) {

var grid = new GridFS(this.db);
/* Check if the filter is an ObjectID, filename or something else */
_id = Grid.tryParseObjectId(param);
_id = grid.tryParseObjectId(param);

@@ -234,3 +232,3 @@ if (_id) {

return Grid.remove(options, (err) => {
grid.remove(options, (err) => {
if (err) {

@@ -244,3 +242,3 @@ callback(err);

callback();
reject();
resolve();
});

@@ -247,0 +245,0 @@ });

{
"name": "fi-gridfs",
"title": "Fi GridFS",
"version": "1.1.0",
"version": "1.1.1",
"description": "Convenience layer for Mongo's GridFS on Node.js applications",

@@ -33,5 +33,5 @@ "main": "index.js",

"chai": "^3.2.0",
"mocha": "^2.2.5",
"mocha": "^3.1.0",
"mongodb": "^2.0.39"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc