New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chrome-fs

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-fs - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0

106

chrome.js

@@ -218,3 +218,3 @@ var util = require('util')

}, function (err) {
if (err.code === 1) {
if (err.name === 'NotFoundError') {
var entryerr = new Error()

@@ -229,3 +229,3 @@ entryerr.code = 'ENOENT'

}, function (err) {
if (err.code === 1) {
if (err.name === 'NotFoundError') {
var entryerr = new Error()

@@ -403,2 +403,5 @@ entryerr.code = 'ENOENT'

}
if (flags.indexOf('x') > -1) {
opts.exclusive = true
}
cfs.root.getFile(

@@ -410,3 +413,3 @@ path,

// otherwise we get the file because 'standards'
if (flags.indexOf('w') > -1) {
if (flags.indexOf('w') > -1 || flags.indexOf('a') > -1) {
fileEntry.createWriter(function (fileWriter) {

@@ -423,6 +426,18 @@ fileWriter.fullPath = fileEntry.fullPath

// Work around for directory file descriptor
if (err.name === 'TypeMismatchError') {
var dird = {}
dird.filePath = path
callback(null, dird)
if (err.name === 'TypeMismatchError' || err.name === 'SecurityError') {
// It's a write on a directory
if (flags.indexOf('w') > -1) {
var eisdir = new Error()
eisdir.code = 'EISDIR'
callback(eisdir)
} else {
var dird = {}
dird.filePath = path
callback(null, dird)
}
} else if (err.name === 'InvalidModificationError') {
var eexists = new Error()
eexists.code = 'EEXIST'
callback(eexists)
} else {

@@ -514,3 +529,7 @@ callback(err)

fileReader.onload = function (evt) {
window.setTimeout(callback, 0, null, this.result)
if (options.encoding === null) {
window.setTimeout(callback, 0, null, new Buffer(this.result, 'binary'))
} else {
window.setTimeout(callback, 0, null, this.result)
}
}

@@ -599,3 +618,5 @@ fileReader.onerror = function (evt) {

var path = resolve(fd)
window.requestFileSystem(
exports.exists(path, function (exists) {
if (exists) {
window.requestFileSystem(
window.PERSISTENT, FILESYSTEM_DEFAULT_SIZE,

@@ -610,2 +631,9 @@ function (cfs) {

}, callback)
} else {
var enoent = new Error()
enoent.code = 'ENOENT'
enoent.path = path
callback(enoent)
}
})
}

@@ -928,3 +956,2 @@

WriteStream.prototype._write = function (data, encoding, callbk) {
if (!util.isBuffer(data)) {

@@ -949,3 +976,21 @@ return this.emit('error', new Error('Invalid data'))

var self = this
this.fd.onerror = callback
this.fd.onerror = function (err) {
if (err.name === 'TypeMismatchError') {
// It's a write on a directory
if (self.flags.indexOf('w')) {
var eisdir = new Error()
eisdir.code = 'EISDIR'
callback(eisdir)
} else {
callback(err)
}
} else if (err.name === 'InvalidModificationError') {
var eexists = new Error()
eexists.code = 'EEXIST'
callback(eexists)
} else {
callback(err)
}
}
var bufblob = new Blob([data], {type: 'application/octet-binary'}) // eslint-disable-line

@@ -959,15 +1004,30 @@ if (this.fd.readyState > 0) {

} else {
this.fd.write(bufblob)
this.bytesWritten += data.length
callback(null, bufblob.length)
if (typeof this.fd.write === 'function') {
if (this.flags.indexOf('a') > -1) {
this.fd.seek(this.fd.length)
}
this.fd.write(bufblob)
this.bytesWritten += data.length
callback(null, bufblob.length)
} else {
if (typeof this.tmpbuffer === 'undefined') {
this.tmpbuffer = []
}
this.tmpbuffer += data
this.isWriting = false
}
}
this.fd.onwriteend = function (e) {
if (!self.isWriting) {
if (self.tmpbuffer.length > 0) {
self.isWriting = true
var tmpblob = new Blob([self.tmpbuffer], {type: 'application/octet-binary'}) // eslint-disable-line
self.tmpbuffer = []
self.fd.write(tmpblob)
callback(null, tmpblob.length)
self.bytesWritten += self.tmpbuffer.length
// When the ws.end() is called directly without an 'write'
// this.fd.onwriteend = function (e) { throws an is null error
if (this.fd !== null) {
this.fd.onwriteend = function (e) {
if (!self.isWriting) {
if (self.tmpbuffer.length > 0) {
self.isWriting = true
var tmpblob = new Blob([self.tmpbuffer], {type: 'application/octet-binary'}) // eslint-disable-line
self.tmpbuffer = []
self.fd.write(tmpblob)
callback(null, tmpblob.length)
self.bytesWritten += self.tmpbuffer.length
}
}

@@ -974,0 +1034,0 @@ }

{
"name": "chrome-fs",
"version": "3.1.0",
"version": "4.0.0",
"description": "Use the Node `fs` API in Chrome Apps",

@@ -15,3 +15,5 @@ "main": "main.js",

"keywords": [
"chrome"
"chrome",
"browserify-tool",
"chromiumify"
],

@@ -18,0 +20,0 @@ "author": "anton whalley",

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