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

copy

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

66

index.js

@@ -124,7 +124,8 @@ 'use strict';

var opts = defaults(fp, dest, options);
mkdir(dest, opts, function (err) {
var destFile = opts.rewrite(fp, dest);
mkdir(path.dirname(destFile), opts, function (err) {
if (err) return cb(err);
try {
copy.base(fp, opts.rewrite(fp, dest), opts);
copy.base(fp, destFile, opts);
return cb();

@@ -150,5 +151,6 @@ } catch(err) {

var opts = defaults(fp, dest, options);
var destFile = opts.rewrite(fp, dest);
try {
mkdir.sync(dest, opts);
copy.base(fp, opts.rewrite(fp, dest));
mkdir.sync(path.dirname(destFile), opts);
copy.base(fp, destFile);
} catch (err) {

@@ -159,36 +161,2 @@ throw new Error(err);

copy.onePromise = function copyOnePromise(fp, dest) {
var deferred = Promise.defer();
var error = function (err) {
deferred.reject(err);
};
var cb = function (err) {
deferred.resolve(err);
};
mkdirPromise(fp, dest)
.then(function () {
})
// var rs = fs.createReadStream(fp);
// rs.on("error", error);
// var ws = fs.createWriteStream(dest);
// ws.on("error", error);
// ws.on("close", cb);
// rs.pipe(ws);
// return deferred.promise;
};
// function (src, dest, cb) {
// var copyPromise = copyDirs(src, dest);
// if (!cb) return copyPromise;
// copyPromise.then(cb);
// }
/**

@@ -205,17 +173,5 @@ * Base function for copying files.

src = path.resolve(opts.cwd, src);
var rs = fs.createReadStream(src);
var ws = fs.createWriteStream(dest);
rs.pipe(ws);
fs.createReadStream(src).pipe(fs.createWriteStream(dest));
};
function mkdirPromise(dir, opts) {
return new Promise(function (resolve, reject) {
mkdir(dir, opts, function (err, made) {
if (err) return reject(err);
return resolve(made);
});
});
};
/**

@@ -230,9 +186,2 @@ * Rewrite the destination file path.

function rewrite(fp, dest, options) {
// options = options || {};
// if (options.flatten) {
// dest = path.basename(dest);
// }
// if (options.destBase) {
// dest = path.join(options.destBase, dest);
// }
return path.resolve(dest, path.basename(fp));

@@ -267,3 +216,2 @@ }

/**

@@ -270,0 +218,0 @@ * Expose `copy`

20

package.json
{
"name": "copy",
"description": "Copy files or directories using globs.",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/copy",

@@ -24,8 +24,7 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"async": "^1.3.0",
"bluebird": "^2.9.30",
"extend-shallow": "^2.0.0",
"async": "^1.4.2",
"bluebird": "^2.10.0",
"extend-shallow": "^2.0.1",
"glob-parent": "^1.2.0",
"graceful-fs": "^4.1.2",
"lazy-cache": "^0.1.0",
"lazy-globby": "^0.1.1",

@@ -58,9 +57,6 @@ "mkdirp": "^0.5.1"

"write",
"write-yaml",
"copy",
"write-json",
"read-data",
"glob-fs",
"micromatch",
"delete",
"expand-config",
"expand-target",
"expand-task",
"expand-files",
"export-files"

@@ -67,0 +63,0 @@ ]

@@ -110,3 +110,3 @@ # copy [![NPM version](https://badge.fury.io/js/copy.svg)](http://badge.fury.io/js/copy)

### [.oneSync](index.js#L147)
### [.oneSync](index.js#L148)

@@ -123,3 +123,3 @@ Synchronously copy a single file from `a` to `b`. A thin wrapper around the `copy.base`

### [.base](index.js#L166)
### [.base](index.js#L168)

@@ -136,3 +136,8 @@ Base function for copying files.

{%= related(['write', 'read-data', 'read-yaml', 'export-files']) %}
* [expand-config](https://www.npmjs.com/package/expand-config): Expand tasks, targets and files in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-config)
* [expand-files](https://www.npmjs.com/package/expand-files): Expand glob patterns in a declarative configuration into src-dest mappings. | [homepage](https://github.com/jonschlinkert/expand-files)
* [expand-target](https://www.npmjs.com/package/expand-target): Expand target definitions in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-target)
* [expand-task](https://www.npmjs.com/package/expand-task): Expand and normalize task definitions in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-task)
* [export-files](https://www.npmjs.com/package/export-files): node.js utility for exporting a directory of files as modules. | [homepage](https://github.com/jonschlinkert/export-files)
* [write](https://www.npmjs.com/package/write): Write files to disk, creating intermediate directories if they don't exist. | [homepage](https://github.com/jonschlinkert/write)

@@ -149,3 +154,3 @@ ## Running tests

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/copy/issues/new)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/copy/issues/new).

@@ -166,2 +171,2 @@ ## Author

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 03, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 14, 2015._
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