metalsmith-downloader
Advanced tools
Comparing version 0.2.0 to 0.2.1
16
index.js
@@ -26,2 +26,3 @@ /** | ||
var request = require('request'); | ||
var crypto = require('crypto'); | ||
var queue = require('queue'); | ||
@@ -119,2 +120,8 @@ | ||
function sha1Hash(data) { | ||
var hash = crypto.createHash('sha1'); | ||
hash.update(data); | ||
return hash.digest('hex'); | ||
} | ||
function createProcessFile(options) { | ||
@@ -129,2 +136,8 @@ var incremental = options.incremental; | ||
if (cacheDir) { | ||
// If we are using a cache dir we need to add a hash of source URL to path, | ||
// otherwise we cannot detect if the source URL has changed at some point. | ||
filepath = path.resolve(cacheDir, sha1Hash(contentsUrl), filename); | ||
} | ||
return checkFileExists(filepath) | ||
@@ -147,4 +160,3 @@ .then(function(exists) { | ||
if (file.mode) { | ||
// FIXME: Shouldn't this affect filepath and not filename? | ||
return chmodFile(filename, file.mode); | ||
return chmodFile(filepath, file.mode); | ||
} | ||
@@ -151,0 +163,0 @@ |
{ | ||
"name": "metalsmith-downloader", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Download assets dynamically in your Metalsmith build", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8134
203