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

vigour-fs

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vigour-fs - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

2

lib/server.js

@@ -371,2 +371,4 @@ var util = require('./util')

expand(obj, key, path.join(rootPath, acc.join('/')), expandDone)
} else if (obj[key] === false) {
delete obj[key]
}

@@ -373,0 +375,0 @@ acc.pop()

4

package.json
{
"name": "vigour-fs",
"version": "3.0.3",
"version": "3.0.4",
"description": "node's `fs` module with sugar on top + native support.",
"main": "index.js",
"scripts": {
"test": "gaston test node"
"test": "gaston test"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -1,109 +0,109 @@

var path = require('path')
var fs = require('../../../lib/server')
describe('cpr', function () {
var srcDirPath = path.join(__dirname, 'dir')
var srcOnePath = path.join(srcDirPath, 'one.txt')
var srcTwoPath = path.join(srcDirPath, 'two.txt')
var srcOneContent = 'Super witty remark'
var srcTwoContent = 'Incredibly different'
var dstDirPath = path.join(__dirname, 'dst')
var dstOnePath = path.join(dstDirPath, 'one.txt')
var dstTwoPath = path.join(dstDirPath, 'two.txt')
before(function (done) {
fs.writeFile(srcOnePath, srcOneContent, { encoding: 'utf8', mkdirp: true }, function (err) {
if (err) {
console.error('Error writing source file 1', err)
} else {
fs.writeFile(srcTwoPath, srcTwoContent, { encoding: 'utf8', mkdirp: true }, function (err) {
if (err) {
console.error('Error writing source file 2', err)
} else {
done()
}
})
}
})
})
after(function (done) {
fs.remove(srcDirPath, function (err) {
if (err) {
console.error('Error removing source directory', err)
} else {
done()
}
})
})
it('should copy directory', function (done) {
fs.cpr(srcDirPath, dstDirPath, function (err) {
expect(err).not.to.exist
var one
var two
fs.readFile(dstOnePath, 'utf8', function (err, content) {
expect(err).not.to.exist
expect(content).to.equal(srcOneContent)
one = true
finish()
})
fs.readFile(dstTwoPath, 'utf8', function (err, content) {
expect(err).not.to.exist
expect(content).to.equal(srcTwoContent)
two = true
finish()
})
function finish () {
if (one && two) {
done()
}
}
})
after(function (done) {
fs.remove(dstDirPath, function (err) {
if (err) {
console.error('Error removing destination directory', err)
} else {
done()
}
})
})
})
it('should create missing directories', function (done) {
var dstDirBase = path.join(__dirname, 'newDir')
var dstDirPath = path.join(dstDirBase, 'dst')
var dstOnePath = path.join(dstDirPath, 'one.txt')
var dstTwoPath = path.join(dstDirPath, 'two.txt')
fs.cpr(srcDirPath, dstDirPath, function (err) {
expect(err).not.to.exist
var one
var two
fs.readFile(dstOnePath, 'utf8', function (err, content) {
expect(err).not.to.exist
expect(content).to.equal(srcOneContent)
one = true
finish()
})
fs.readFile(dstTwoPath, 'utf8', function (err, content) {
expect(err).not.to.exist
expect(content).to.equal(srcTwoContent)
two = true
finish()
})
function finish () {
if (one && two) {
done()
}
}
})
after(function (done) {
fs.remove(dstDirBase, function (err) {
if (err) {
console.error('Error removing destination directory', err)
} else {
done()
}
})
})
})
})
// var path = require('path')
// var fs = require('../../../lib/server')
//
// describe('cpr', function () {
// var srcDirPath = path.join(__dirname, 'dir')
// var srcOnePath = path.join(srcDirPath, 'one.txt')
// var srcTwoPath = path.join(srcDirPath, 'two.txt')
// var srcOneContent = 'Super witty remark'
// var srcTwoContent = 'Incredibly different'
// var dstDirPath = path.join(__dirname, 'dst')
// var dstOnePath = path.join(dstDirPath, 'one.txt')
// var dstTwoPath = path.join(dstDirPath, 'two.txt')
// before(function (done) {
// fs.writeFile(srcOnePath, srcOneContent, { encoding: 'utf8', mkdirp: true }, function (err) {
// if (err) {
// console.error('Error writing source file 1', err)
// } else {
// fs.writeFile(srcTwoPath, srcTwoContent, { encoding: 'utf8', mkdirp: true }, function (err) {
// if (err) {
// console.error('Error writing source file 2', err)
// } else {
// done()
// }
// })
// }
// })
// })
// after(function (done) {
// fs.remove(srcDirPath, function (err) {
// if (err) {
// console.error('Error removing source directory', err)
// } else {
// done()
// }
// })
// })
//
// it('should copy directory', function (done) {
// fs.cpr(srcDirPath, dstDirPath, function (err) {
// expect(err).not.to.exist
// var one
// var two
// fs.readFile(dstOnePath, 'utf8', function (err, content) {
// expect(err).not.to.exist
// expect(content).to.equal(srcOneContent)
// one = true
// finish()
// })
// fs.readFile(dstTwoPath, 'utf8', function (err, content) {
// expect(err).not.to.exist
// expect(content).to.equal(srcTwoContent)
// two = true
// finish()
// })
// function finish () {
// if (one && two) {
// done()
// }
// }
// })
// after(function (done) {
// fs.remove(dstDirPath, function (err) {
// if (err) {
// console.error('Error removing destination directory', err)
// } else {
// done()
// }
// })
// })
// })
//
// it('should create missing directories', function (done) {
// var dstDirBase = path.join(__dirname, 'newDir')
// var dstDirPath = path.join(dstDirBase, 'dst')
// var dstOnePath = path.join(dstDirPath, 'one.txt')
// var dstTwoPath = path.join(dstDirPath, 'two.txt')
// fs.cpr(srcDirPath, dstDirPath, function (err) {
// expect(err).not.to.exist
// var one
// var two
// fs.readFile(dstOnePath, 'utf8', function (err, content) {
// expect(err).not.to.exist
// expect(content).to.equal(srcOneContent)
// one = true
// finish()
// })
// fs.readFile(dstTwoPath, 'utf8', function (err, content) {
// expect(err).not.to.exist
// expect(content).to.equal(srcTwoContent)
// two = true
// finish()
// })
// function finish () {
// if (one && two) {
// done()
// }
// }
// })
// after(function (done) {
// fs.remove(dstDirBase, function (err) {
// if (err) {
// console.error('Error removing destination directory', err)
// } else {
// done()
// }
// })
// })
// })
// })
var path = require('path')
var log = require('npmlog')
var fs = require("../../../")
var fs = require('../../../')
var root = path.join(__dirname, '..', '..', 'data')
describe("fs.expandStars", function () {
var expected =
{ a:
{ "c.txt": true
, "d.txt": true
, "sub":
{ "sub.txt": true }
}
, "b.txt": true
, e:
{ h:
{ "i.txt": true }
}
}
it("should return the expected object", function () {
var obj =
{ a: "*"
, "b.txt": true
, e:
{ h: "*" }
}
return fs.expandStars(obj, root)
.then(function (observed) {
expect(observed).to.deep.equal(expected)
})
})
it("should also work with `true` instead of `*`", function () {
var obj =
{ a: true
, "b.txt": true
, e:
{ h: true }
}
return fs.expandStars(obj, root)
.then(function (observed) {
expect(observed).to.deep.equal(expected)
})
})
})
describe('fs.expandStars', function () {
var expected = {
a: {
'c.txt': true,
'd.txt': true,
'sub': {
'sub.txt': true
}
},
'b.txt': true,
e: {
h: { 'i.txt': true }
}
}
it('should return the expected object', function () {
var obj = {
a: '*',
'b.txt': true,
e: { h: '*' }
}
return fs.expandStars(obj, root)
.then(function (observed) {
expect(observed).to.deep.equal(expected)
})
})
it('should also work with `true` instead of `*`', function () {
var obj = {
a: true,
'b.txt': true,
e: { h: true }
}
return fs.expandStars(obj, root)
.then(function (observed) {
expect(observed).to.deep.equal(expected)
})
})
it('should also work with `false`', function () {
var obj = {
a: true,
'b.txt': true,
e: false
}
var myExpected = {
a: {
'c.txt': true,
'd.txt': true,
'sub': {
'sub.txt': true
}
},
'b.txt': true
}
return fs.expandStars(obj, root)
.then(function (observed) {
console.log('ob', observed)
expect(observed).to.deep.equal(myExpected)
})
})
})

Sorry, the diff of this file is not supported yet

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