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

giga

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

giga - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

10

lib/Giga.js
'use strict';
const debug = require('debug')('giga');
const path = require('path');

@@ -14,2 +15,4 @@ const url = require('url');

throw new Error('Storage must be provided');
debug('create an instance');
}

@@ -36,2 +39,4 @@

debug(`[upload] path=${result.filePath} url=${result.url}`);
return this.storage.upload(src, filePath)

@@ -60,2 +65,5 @@ .then(() => result);

};
debug(`[download] path=${result.filePath} url=${result.url}`);
return this.storage.download(filePath, options)

@@ -81,2 +89,4 @@ .then(src => {

debug(`[remove] path=${filePath}`);
return this.storage

@@ -83,0 +93,0 @@ .remove(filePath)

2

package.json
{
"name": "giga",
"version": "0.2.1",
"version": "0.2.2",
"description": "Easy streaming upload and download for storages(File System, AWS S3)",

@@ -5,0 +5,0 @@ "license": "MIT",

'use strict';
const debug = require('debug')('giga');
const fs = require('fs');

@@ -51,2 +52,4 @@ const path = require('path');

this.baseUrl = baseUrl.replace(/([^/])$/, '$1/');
debug('[storage-local] create an instance');
}

@@ -66,2 +69,3 @@

const src = fs.createReadStream(target, options);
debug(`[storage-local:download] path=${target}`);
resolve(src);

@@ -89,2 +93,4 @@ } catch (err) {

const dst = fs.createWriteStream(target, options);
debug(`[storage-local:upload] path=${target}`);
return new Promise((resolve, reject) => {

@@ -108,2 +114,3 @@ src.pipe(dst)

return new Promise((resolve, reject) => {
debug(`[storage-local:remove] path=${target}`);
return fs.unlink(target, err => err ? reject(err) : resolve(target));

@@ -110,0 +117,0 @@ });

'use strict';
const debug = require('debug')('giga');
const url = require('url');

@@ -32,2 +33,4 @@ const S3 = require('aws-sdk/clients/s3');

this.client = new S3(this.options);
debug('[storage-s3] create an instance');
}

@@ -49,2 +52,3 @@

const src = request.createReadStream();
debug(`[storage-s3:download] Bucket=${params['Bucket']} Key=${params['Key']}`);

@@ -71,2 +75,4 @@ return new Promise((resolve, reject) => {

}, options);
debug(`[storage-s3:upload] Bucket=${params['Bucket']} Key=${params['Key']}`);
return this.client.upload(params).promise();

@@ -88,2 +94,3 @@ }

const request = this.client.deleteObject(params).promise();
debug(`[storage-s3:remove] Bucket=${params['Bucket']} Key=${params['Key']}`);
return request.then(() => filePath);

@@ -90,0 +97,0 @@ }

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