Support paths as Buffers
This commit is contained in:
parent
30fbe92970
commit
8eca019157
2 changed files with 9 additions and 0 deletions
|
@ -37,6 +37,10 @@
|
||||||
return [false]
|
return [false]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Buffer.isBuffer(p)) {
|
||||||
|
p = p.toString()
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof p !== 'string') {
|
if (typeof p !== 'string') {
|
||||||
return [false]
|
return [false]
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,11 @@ describe('asar package', function () {
|
||||||
var fixtures = path.join(__dirname, 'fixtures')
|
var fixtures = path.join(__dirname, 'fixtures')
|
||||||
|
|
||||||
describe('node api', function () {
|
describe('node api', function () {
|
||||||
|
it('supports paths specified as a Buffer', function () {
|
||||||
|
var file = new Buffer(path.join(fixtures, 'asar', 'a.asar', 'file1'))
|
||||||
|
assert.equal(fs.existsSync(file), true)
|
||||||
|
})
|
||||||
|
|
||||||
describe('fs.readFileSync', function () {
|
describe('fs.readFileSync', function () {
|
||||||
it('does not leak fd', function () {
|
it('does not leak fd', function () {
|
||||||
var readCalls = 1
|
var readCalls = 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue