Socket
Socket
Sign inDemoInstall

fs-jetpack

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-jetpack - npm Package Compare versions

Comparing version 0.10.2 to 0.10.3

4

CHANGELOG.md

@@ -0,1 +1,5 @@

0.10.3 (2016-11-23)
-------------------
* Fixed directory tree traversal bug which was causing problems for `findAsync()` and `copyAsync()`.
0.10.2 (2016-11-08)

@@ -2,0 +6,0 @@ -------------------

4

lib/utils/tree_walker.js

@@ -53,4 +53,4 @@ /* eslint no-underscore-dangle:0 */

return node.nextSibling;
} else if (node.parent && node.parent.nextSibling) {
return node.parent.nextSibling;
} else if (node.parent) {
return findNextUnprocessedNode(node.parent);
}

@@ -57,0 +57,0 @@ return undefined;

{
"name": "fs-jetpack",
"description": "Better file system API",
"version": "0.10.2",
"version": "0.10.3",
"author": "Jakub Szwacz <jakub@szwacz.com>",

@@ -6,0 +6,0 @@ "dependencies": {

@@ -65,3 +65,3 @@ fs-jetpack [![Build Status](https://travis-ci.org/szwacz/fs-jetpack.svg?branch=master)](https://travis-ci.org/szwacz/fs-jetpack) [![Build status](https://ci.appveyor.com/api/projects/status/er206e91fpuuqf58?svg=true)](https://ci.appveyor.com/project/szwacz/fs-jetpack) [![codecov](https://codecov.io/gh/szwacz/fs-jetpack/branch/master/graph/badge.svg)](https://codecov.io/gh/szwacz/fs-jetpack)

**parameters:**
**arguments:**
`path` the path to file.

@@ -81,3 +81,3 @@ `data` data to append (can be `String` or `Buffer`).

**parameters:**
**arguments:**
`from` path to location you want to copy.

@@ -131,3 +131,3 @@ `to` path to destination location, where the copy should be placed.

**parameters:**
**arguments:**
`path...` (optional) path (or many path parts) to become new CWD. Could be absolute, or relative. If relative path given new CWD will be resolved basing on current CWD of this jetpack instance.

@@ -167,3 +167,3 @@

**parameters:**
**arguments:**
`path` path to directory to examine.

@@ -210,3 +210,3 @@ `criteria` (optional) criteria to be met by the directory. Is an `Object` with possible fields:

**parameters:**
**arguments:**
`path` path to file to examine.

@@ -236,3 +236,3 @@ `criteria` (optional) criteria to be met by the file. Is an `Object` with possible fields:

**parameters:**
**arguments:**
`path` (optional, defaults to `'.'`) path to start search in (all subdirectories will be searched).

@@ -269,3 +269,3 @@ `searchOptions` is an `Object` with possible fields:

**parameters:**
**arguments:**
`path` path to inspect.

@@ -304,3 +304,3 @@ `options` (optional). Possible values:

**parameters:**
**arguments:**
`path` the starting path to inspect.

@@ -348,3 +348,3 @@ `options` (optional). Possible values:

**parameters:**
**arguments:**
`path` (optional) path to directory you would like to list. If not specified defaults to CWD.

@@ -361,3 +361,3 @@

**parameters:**
**arguments:**
`from` path to directory or file you want to move.

@@ -373,3 +373,3 @@ `to` path where the thing should be moved.

**parameters:**
**arguments:**
`parts` strings to join and resolve as path (as many as you like).

@@ -394,3 +394,3 @@

**parameters:**
**arguments:**
`path` path to file.

@@ -413,3 +413,3 @@ `returnAs` (optional) how the content of file should be returned. Is a string with possible values:

**parameters:**
**arguments:**
`path` (optional) path to file or directory you want to remove. If not specified the remove action will be performed on current working directory (CWD).

@@ -440,3 +440,3 @@

**parameters:**
**arguments:**
`path` path to thing you want to change name of.

@@ -459,3 +459,3 @@ `newName` new name for this thing (not full path, just a name).

**parameters:**
**arguments:**
`symlinkValue` path where symbolic link should point.

@@ -473,3 +473,3 @@ `path` path where symbolic link should be put.

**parameters:**
**arguments:**
`path` path to file.

@@ -476,0 +476,0 @@ `data` data to be written. This could be `String`, `Buffer`, `Object` or `Array` (if last two used, the data will be outputted into file as JSON).

@@ -101,2 +101,95 @@ /* eslint no-console:0 */

describe('can walk through many nested directories', function () {
var preparations = function () {
fse.outputFileSync('a/b/x/z1.txt', 'z1');
fse.outputFileSync('a/c/y/z2.txt', 'z2');
};
var expectations = function (data) {
expect(data).to.eql([
{
path: pathUtil.resolve('a'),
item: {
type: 'dir',
name: 'a'
}
},
{
path: pathUtil.resolve('a', 'b'),
item: {
type: 'dir',
name: 'b'
}
},
{
path: pathUtil.resolve('a', 'b', 'x'),
item: {
type: 'dir',
name: 'x'
}
},
{
path: pathUtil.resolve('a', 'b', 'x', 'z1.txt'),
item: {
type: 'file',
name: 'z1.txt',
size: 2
}
},
{
path: pathUtil.resolve('a', 'c'),
item: {
type: 'dir',
name: 'c'
}
},
{
path: pathUtil.resolve('a', 'c', 'y'),
item: {
type: 'dir',
name: 'y'
}
},
{
path: pathUtil.resolve('a', 'c', 'y', 'z2.txt'),
item: {
type: 'file',
name: 'z2.txt',
size: 2
}
}
]);
};
it('sync', function () {
var absoluteStartingPath = pathUtil.resolve('a');
var data = [];
preparations();
walker.sync(absoluteStartingPath, {}, function (path, item) {
data.push({ path: path, item: item });
});
expectations(data);
});
it('async', function (done) {
var absoluteStartingPath = pathUtil.resolve('a');
var data = [];
var st;
preparations();
st = walker.stream(absoluteStartingPath, {})
.on('readable', function () {
var a = st.read();
if (a) {
data.push(a);
}
})
.on('error', console.error)
.on('end', function () {
expectations(data);
done();
});
});
});
describe("won't penetrate folder tree deeper than maxLevelsDeep option tells", function () {

@@ -103,0 +196,0 @@ var options = {

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