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

hexo-fs

Package Overview
Dependencies
Maintainers
5
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-fs - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

.editorconfig

101

lib/fs.js

@@ -24,4 +24,3 @@ 'use strict';

var accessSync = fs.accessSync;
var accessAsync;
var exists, existsSync;
var accessAsync, exists, existsSync;

@@ -164,17 +163,22 @@ if (fs.access) {

function copyFile(src, dest, callback) {
const _copyFile = fs.copyFile ? Promise.promisify(fs.copyFile) : function(src, dest) {
return new Promise(function(resolve, reject) {
var rs = createReadStream(src);
var ws = createWriteStream(dest);
rs.pipe(ws).on('error', reject);
ws.on('close', resolve).on('error', reject);
});
};
function copyFile(src, dest, flags, callback) {
if (!src) throw new TypeError('src is required!');
if (!dest) throw new TypeError('dest is required!');
if (typeof flags === 'function') {
callback = flags;
}
return checkParent(dest).then(function() {
return new Promise(function(resolve, reject) {
var rs = createReadStream(src);
var ws = createWriteStream(dest);
rs.pipe(ws)
.on('error', reject);
ws.on('close', resolve)
.on('error', reject);
});
return _copyFile(src, dest, flags);
}).asCallback(callback);

@@ -268,13 +272,13 @@ }

})
.map(function(item) {
var childSrc = item.fullPath;
var childDest = join(dest, item.path);
.map(function(item) {
var childSrc = item.fullPath;
var childDest = join(dest, item.path);
if (item.isDirectory) {
return _copyDir(childSrc, childDest, options, join(parent, item.path));
}
if (item.isDirectory) {
return _copyDir(childSrc, childDest, options, join(parent, item.path));
}
return copyFile(childSrc, childDest, options)
.thenReturn(join(parent, item.path));
}).reduce(reduceFiles, []);
return copyFile(childSrc, childDest, options)
.thenReturn(join(parent, item.path));
}).reduce(reduceFiles, []);
}

@@ -385,16 +389,16 @@

return _readAndFilterDir(path, options)
.filter(ignoreExcludeFiles(options.exclude, parent))
.map(function(item) {
var fullPath = item.fullPath;
.filter(ignoreExcludeFiles(options.exclude, parent))
.map(function(item) {
var fullPath = item.fullPath;
if (item.isDirectory) {
return _emptyDir(fullPath, options, join(parent, item.path)).then(function(removed) {
return readdirAsync(fullPath).then(function(files) {
if (!files.length) return rmdirAsync(fullPath);
}).thenReturn(removed);
});
}
if (item.isDirectory) {
return _emptyDir(fullPath, options, join(parent, item.path)).then(function(removed) {
return readdirAsync(fullPath).then(function(files) {
if (!files.length) return rmdirAsync(fullPath);
}).thenReturn(removed);
});
}
return unlinkAsync(fullPath).thenReturn(join(parent, item.path));
}).reduce(reduceFiles, []);
return unlinkAsync(fullPath).thenReturn(join(parent, item.path));
}).reduce(reduceFiles, []);
}

@@ -420,19 +424,19 @@

return _readAndFilterDirSync(path, options)
.filter(ignoreExcludeFiles(options.exclude, parent))
.map(function(item) {
var childPath = item.fullPath;
.filter(ignoreExcludeFiles(options.exclude, parent))
.map(function(item) {
var childPath = item.fullPath;
if (item.isDirectory) {
var removed = emptyDirSync(childPath, options, join(parent, item.path));
if (item.isDirectory) {
var removed = emptyDirSync(childPath, options, join(parent, item.path));
if (!fs.readdirSync(childPath).length) {
rmdirSync(childPath);
if (!fs.readdirSync(childPath).length) {
rmdirSync(childPath);
}
return removed;
}
return removed;
}
fs.unlinkSync(childPath);
return join(parent, item.path);
}).reduce(reduceFiles, []);
fs.unlinkSync(childPath);
return join(parent, item.path);
}).reduce(reduceFiles, []);
}

@@ -462,4 +466,3 @@

var files = fs.readdirSync(path);
var childPath;
var stats;
var childPath, stats;

@@ -466,0 +469,0 @@ for (var i = 0, len = files.length; i < len; i++) {

{
"name": "hexo-fs",
"version": "0.2.2",
"version": "0.2.3",
"description": "File system module for Hexo.",

@@ -8,3 +8,2 @@ "main": "lib/fs",

"eslint": "eslint .",
"jscs": "jscs .",
"test": "mocha test/index.js",

@@ -37,9 +36,10 @@ "test-cov": "istanbul cover _mocha --print both test/index.js"

"chai": "^3.5.0",
"eslint": "^2.12.0",
"eslint-config-hexo": "^1.0.3",
"eslint": "^4.19.1",
"eslint-config-hexo": "^3.0.0",
"istanbul": "^0.4.3",
"jscs": "^3.0.4",
"jscs-preset-hexo": "^1.0.1",
"mocha": "^2.5.3"
},
"engines": {
"node": ">=6.9.0"
}
}
# hexo-fs
[![Build Status](https://travis-ci.org/hexojs/hexo-fs.svg?branch=master)](https://travis-ci.org/hexojs/hexo-fs) [![NPM version](https://badge.fury.io/js/hexo-fs.svg)](http://badge.fury.io/js/hexo-fs) [![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-fs.svg)](https://coveralls.io/r/hexojs/hexo-fs?branch=master) [![Build status](https://ci.appveyor.com/api/projects/status/wift3c57kei3ylq4/branch/master?svg=true)](https://ci.appveyor.com/project/tommy351/hexo-fs/branch/master)
[![Build Status](https://travis-ci.org/hexojs/hexo-fs.svg?branch=master)](https://travis-ci.org/hexojs/hexo-fs) [![NPM version](https://badge.fury.io/js/hexo-fs.svg)](http://badge.fury.io/js/hexo-fs) [![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-fs.svg)](https://coveralls.io/r/hexojs/hexo-fs?branch=master) [![Build status](https://ci.appveyor.com/api/projects/status/wift3c57kei3ylq4/branch/master?svg=true)](https://ci.appveyor.com/project/tommy351/hexo-fs/branch/master) [![dependencies Status](https://david-dm.org/hexojs/hexo-fs/status.svg)](https://david-dm.org/hexojs/hexo-fs) [![devDependencies Status](https://david-dm.org/hexojs/hexo-fs/dev-status.svg)](https://david-dm.org/hexojs/hexo-fs?type=dev)

@@ -5,0 +5,0 @@ File system module for [Hexo].

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