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

fetch-remote

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-remote - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

README.md

38

index.js

@@ -6,20 +6,44 @@ #!/usr/bin/env node

var request = require('request');
//var AdmZip = require('adm-zip');
var AdmZip = require('adm-zip');
var http = require('http');
var url = require('url');
function download( url, dest ){
url = url || "https://github.com/JDC-FD/gulp-tasks/archive/master.zip";
dest = dest || "gulp_tasks.zip";
/**
* 从指定url下载zip包
* @param {[string]} url [拉取的zip包的路径]
* @param {[strong]} dest [本地放置拉取的zip包名字]
*/
function download( url, dest, cb ){
request({url: url, encoding: null}, function(err, resp, body) {
if(err) throw err;
fs.writeFile(output, body, function(err) {
fs.writeFile(dest, body, function(err) {
console.log("file written!");
if( cb ){
cb( err );
}
});
});
}
/**
* 解压文件到执行目录
* @param {[string]} source [解压文件名字]
* @param {string} dest [解压位置]
* @param {boolean} isOverWrite [是否覆盖]
*/
function extract( source, dest, isOverWrite ){
dest = dest || './';
isOverWrite = isOverWrite || true;
var zip = new AdmZip( source );
zip.extractAllTo(dest, isOverWrite);
}
function rename( oldPath, newPath, cb ){
fs.rename(oldPath, newPath, cb);
}
return {
download: download
download: download,
extract: extract,
rename: rename
}

@@ -26,0 +50,0 @@

2

package.json
{
"name": "fetch-remote",
"version": "1.0.3",
"version": "1.0.4",
"description": "远程拉取文件,批量替换本地对应文件",

@@ -5,0 +5,0 @@ "main": "index.js",

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