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

git-node-fs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-node-fs - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

75

lib/node-fs.js

@@ -12,2 +12,3 @@ "use strict";

fs.readDir = readDir;
fs.rename = rename;

@@ -20,10 +21,6 @@ // Reads all bytes for given path.

if (err) {
if (err.code === "ENOENT") {
callback();
} else {
callback(err);
}
} else {
callback(null, binary);
if (err.code === "ENOENT") return callback();
return callback(err);
}
return callback(null, binary);
});

@@ -46,14 +43,8 @@ }

var chunk = stream.read();
if (chunk === null) {
callback(null, Buffer.concat(chunks));
} else {
chunks.push(chunk);
}
if (chunk === null) return callback(null, Buffer.concat(chunks));
return chunks.push(chunk);
});
stream.on("error", function (err) {
if (err.code === "ENOENT") {
callback();
} else {
callback(err);
}
if (err.code === "ENOENT") return callback();
return callback(err);
});

@@ -68,7 +59,4 @@ }

if (err) {
if (err.code === "EACCES") {
callback();
} else {
callback(err);
}
if (err.code === "EACCES") return callback();
return callback(err);
}

@@ -90,11 +78,8 @@ var buffer = new Buffer(4096);

function onread(err, bytesRead) {
if (err) {
callback(err);
}
if (err) return callback(err);
length += bytesRead;
if (bytesRead === 0) {
callback(null, buffer.slice(0, buffer.length + end));
} else {
read();
return callback(null, buffer.slice(0, buffer.length + end));
}
read();
}

@@ -115,10 +100,22 @@

mkdirp(nodePath.dirname(path), function (err) {
if (err) {
callback(err);
} else {
nodeFs.writeFile(path, binary, callback);
}
if (err) return callback(err);
nodeFs.writeFile(path, binary, callback);
});
}
// Renames the given file.
// Creates all necessary parent directories.
// => undefined
function rename(oldPath, newPath, callback) {
var oldBase = nodePath.dirname(oldPath);
var newBase = nodePath.dirname(newPath);
if (oldBase === newBase) {
return nodeFs.rename(oldPath, newPath, callback);
}
mkdirp(nodePath.dirname(path), function (err) {
if (err) return callback(err);
nodeFs.rename(oldPath, newPath, callback);
});
}
// Reads all entry names for a given path.

@@ -131,10 +128,6 @@ // All names are relative to the directory itself, not fully qualified paths.

if (err) {
if (err.code === "ENOENT") {
callback();
} else {
callback(err);
}
} else {
callback(null, names);
if (err.code === "ENOENT") return callback();
return callback(err);
}
return callback(null, names);
});

@@ -151,3 +144,3 @@ }

if (err && err.code !== "EEXIST") return callback(err);
callback();
return callback();
});

@@ -154,0 +147,0 @@ });

@@ -8,3 +8,3 @@ {

],
"version": "0.1.0",
"version": "1.0.0",
"main": "lib/node-fs.js",

@@ -11,0 +11,0 @@ "scripts": {

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