Socket
Socket
Sign inDemoInstall

s3fs

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s3fs - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

npm-shrinkwrap.json

0

index.js

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

@@ -259,2 +259,25 @@ /*

/**
* Provides a path by concatenating bucket with paths.
*
* @example
* ```js
* // Create an instance of S3FS which has a current working directory of `test-folder` within the S3 bucket `test-bucket`
* var fsImpl = new S3FS(options, 'test-bucket/test-folder');
*
* // Returns location to directory `test-bucket/test-folder/styles
* var fsImplStyles = fsImpl.getPath('styles');
* // Returns location to file `test-bucket/test-folder/styles/main.css
* var fsImplStyles = fsImpl.getPath('styles/main.css');
* // Returns location to file `test-bucket/test-folder
* var fsImplStyles = fsImpl.getPath();
* ```
*
* @param path `String`. _Optional_. The path to to directory or file
* @returns {String}
*/
S3fs.prototype.getPath = function (path) {
return s3Utils.joinPaths(this.bucket, s3Utils.joinPaths(this.path, path));
};
/**
* Provides a clone of the instance of S3FS which has relative access to the specified directory.

@@ -261,0 +284,0 @@ *

@@ -38,2 +38,3 @@ /*

this.currentBuffer = new Buffer(0);
this.bytesWritten = 0;
}

@@ -91,2 +92,3 @@

result.PartNumber = partNumber;
self.bytesWritten += buffer.length;
resolve(result);

@@ -148,2 +150,3 @@ });

}
self.bytesWritten += self.currentBuffer.length;
resolve(data);

@@ -186,2 +189,3 @@ });

Writable.call(this, streamOptions);
this.bytesWritten = 0;
}

@@ -208,5 +212,7 @@

this.multiPartManager.complete().then(function () {
self.bytesWritten = self.multiPartManager.bytesWritten;
self.emit('finish');
execCb(cb);
}, function (reason) {
self.bytesWritten = self.multiPartManager.bytesWritten;
self.emit('error', reason);

@@ -213,0 +219,0 @@ execCb(cb);

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

24

package.json
{
"name": "s3fs",
"version": "2.0.1",
"version": "2.1.0",
"description": "Implementation of Node.JS FS interface using Amazon Simple Storage Service (S3).",

@@ -34,8 +34,3 @@ "keywords": [

],
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"license": "MIT",
"main": "index.js",

@@ -45,19 +40,20 @@ "dependencies": {

"bluebird": "^2.x",
"extend": "^2.x"
"extend": "^3.x"
},
"devDependencies": {
"buddy.js": "^0.x",
"chai": "^2.x",
"chai-as-promised": "^4.x",
"chai": "^3.x",
"chai-as-promised": "^5.x",
"dirty-chai": "^1.x",
"nsp": "^1.x",
"mocha": "^2.x",
"istanbul": "^0.x",
"jscs": "^1.x",
"jshint": "^2.x",
"jsinspect": "^0.x"
"jsinspect": "^0.x",
"mocha": "^2.x",
"nsp": "^1.x",
"through2": "^2.x"
},
"scripts": {
"test": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --timeout 60000 --reporter spec test/ && jshint --show-non-errors . && jscs . && buddy index.js lib test && nsp audit-package"
"test": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --timeout 60000 --reporter spec test/ && jshint --show-non-errors . && jscs . && buddy index.js lib test && nsp audit-package && nsp audit-shrinkwrap"
}
}
# S3FS
[![npm](https://img.shields.io/npm/v/s3fs.svg)](https://www.npmjs.com/package/s3fs)
[![npm](https://img.shields.io/npm/dm/s3fs.svg)](https://www.npmjs.com/package/s3fs)
[![Build Status](https://travis-ci.org/RiptideCloud/s3fs.svg?branch=master)](https://travis-ci.org/RiptideCloud/s3fs)
[![Coverage Status](https://img.shields.io/coveralls/RiptideCloud/s3fs.svg)](https://coveralls.io/r/RiptideCloud/s3fs)
[![Build Status](https://travis-ci.org/RiptideElements/s3fs.svg?branch=master)](https://travis-ci.org/RiptideElements/s3fs)
[![Coverage Status](https://img.shields.io/coveralls/RiptideElements/s3fs.svg)](https://coveralls.io/r/RiptideElements/s3fs)
[![Codacy](https://img.shields.io/codacy/13e0385fd6fc4929a2d1a974c7d0d67f.svg)](https://www.codacy.com/public/davidtpate/s3fs)
[![Code Climate](https://codeclimate.com/github/RiptideCloud/s3fs/badges/gpa.svg)](https://codeclimate.com/github/RiptideCloud/s3fs)
[![David](https://img.shields.io/david/RiptideCloud/s3fs.svg)](https://david-dm.org/RiptideCloud/s3fs)
[![David](https://img.shields.io/david/dev/RiptideCloud/s3fs.svg)](https://david-dm.org/RiptideCloud/s3fs)
[![David](https://img.shields.io/david/peer/RiptideCloud/s3fs.svg)](https://david-dm.org/RiptideCloud/s3fs)
[![Code Climate](https://codeclimate.com/github/RiptideElements/s3fs/badges/gpa.svg)](https://codeclimate.com/github/RiptideElements/s3fs)
[![David](https://img.shields.io/david/RiptideElements/s3fs.svg)](https://david-dm.org/RiptideElements/s3fs)
[![David](https://img.shields.io/david/dev/RiptideElements/s3fs.svg)](https://david-dm.org/RiptideElements/s3fs)
[![David](https://img.shields.io/david/peer/RiptideElements/s3fs.svg)](https://david-dm.org/RiptideElements/s3fs)

@@ -103,2 +103,19 @@ Implementation of Node.JS [FS interface](http://nodejs.org/api/fs.html) using [Amazon Simple Storage Service (S3)](http://aws.amazon.com/s3/) for storage.

### s3fs.getPath(path)
Provides a location by concatenating the bucket with path(s).
* path `String`. _Optional_. The relative path to the working directory or file
```js
// Create an instance of S3FS which has a current working directory of `test-folder` within the S3 bucket `test-bucket`
var fsImpl = new S3FS(options, 'test-bucket/test-folder');
// Returns location to directory `test-bucket/test-folder/styles
var fsImplStyles = fsImpl.getPath('styles');
// Returns location to file `test-bucket/test-folder/styles/main.css
var fsImplStyles = fsImpl.getPath('styles/main.css');
// Returns location to file `test-bucket/test-folder
var fsImplStyles = fsImpl.getPath();
```
### s3fs.clone(path)

@@ -321,2 +338,2 @@ Provides a clone of the instance of S3FS which has relative access to the specified directory.

## Copyright
> Copyright (c) 2014 Riptide Software Inc.
> Copyright (c) 2015 Riptide Software Inc.

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

@@ -26,3 +26,4 @@ /*

'use strict';
var expect = chai.expect;
var expect = chai.expect,
through = require('through2');

@@ -270,10 +271,19 @@ chai.use(chaiAsPromised);

return expect(new Promise(function (resolve, reject) {
fs.createReadStream('./test/mock/example-file.json')
.pipe(bucketS3fsImpl.createWriteStream('test-pipe.json'))
.on('finish', function () {
resolve();
})
var fileReadStream = fs.createReadStream('./test/mock/example-file.json'),
s3fsWriteStream = bucketS3fsImpl.createWriteStream('test-pipe.json'),
bytesRead = 0,
calculateBytesWritten = through(function (chunk, enc, cb) {
bytesRead += chunk.length;
this.push(chunk);
cb();
});
s3fsWriteStream.on('finish', function () {
expect(s3fsWriteStream).to.have.property('bytesWritten', bytesRead);
resolve();
})
.on('error', function (err) {
reject(err);
});
fileReadStream.pipe(calculateBytesWritten).pipe(s3fsWriteStream);
})).to.eventually.be.fulfilled();

@@ -284,5 +294,13 @@ });

return expect(new Promise(function (resolve, reject) {
fs.createReadStream('./test/mock/large-file.txt')
.pipe(bucketS3fsImpl.createWriteStream('test-pipe-callback.txt'))
var fileReadStream = fs.createReadStream('./test/mock/large-file.txt'),
s3fsWriteStream = bucketS3fsImpl.createWriteStream('test-pipe-callback.txt'),
bytesRead = 0,
calculateBytesWritten = through(function (chunk, enc, cb) {
bytesRead += chunk.length;
this.push(chunk);
cb();
});
s3fsWriteStream
.on('finish', function () {
expect(s3fsWriteStream).to.have.property('bytesWritten', bytesRead);
resolve();

@@ -293,2 +311,5 @@ })

});
fileReadStream.pipe(calculateBytesWritten).pipe(s3fsWriteStream);
})).to.eventually.be.fulfilled();

@@ -295,0 +316,0 @@ });

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

{
"test": "example"
}

@@ -33,2 +33,3 @@ /*

var s3Credentials,
bucketNamePrefix = 's3fs-clone-test-bucket-',
bucketName,

@@ -47,3 +48,3 @@ bucketS3fsImpl,

};
bucketName = 's3fs-clone-test-bucket-' + (Math.random() + '').slice(2, 8);
bucketName = bucketNamePrefix + (Math.random() + '').slice(2, 8);
s3fsImpl = new S3FS(bucketName, s3Credentials);

@@ -101,2 +102,17 @@

it('should be able to retrieve bucket/path/imAClone', function () {
var path = s3fsImpl.getPath('imAClone');
return expect(path).to.contain(bucketNamePrefix).to.contain('imAClone');
});
it('should not retrieve bucket/path with undefined', function () {
var path = s3fsImpl.getPath(undefined);
return expect(path).to.contain(bucketNamePrefix).not.contain('undefined');
});
it('should not retrieve bucket/path with null', function () {
var path = s3fsImpl.getPath(null);
return expect(path).to.contain(bucketNamePrefix).not.contain('null');
});
it('should be able to clone s3fs', function () {

@@ -103,0 +119,0 @@ return expect(bucketS3fsImpl.clone('imAClone')).to.not.throw;

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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