Comparing version 5.6.3 to 5.7.0
@@ -345,5 +345,12 @@ var tilelive = exports; | ||
if (err) return callback(err); | ||
copy(src, dst, options, callback); | ||
copy(src, dst, options, function(err) { | ||
if (err) return callback(err); | ||
if (options.close) closingTime(src, dst, function(err) { | ||
if (err) throw err; | ||
callback(); | ||
}); | ||
else callback(); | ||
}); | ||
}); | ||
function copy(src, dst, opts, callback) { | ||
@@ -381,3 +388,3 @@ // copy to outStream, if present. This is done after the src is loaded | ||
var put = options.outStream; | ||
var hasErrored = false; | ||
@@ -391,5 +398,8 @@ function handleError(err) { | ||
put.on('error', handleError); | ||
put.on('finish', callback); | ||
get.on('length', prog.setLength); | ||
if (options.progress) prog.on('progress', function(p) { options.progress(get.stats, p); }); | ||
if (options.outStream === process.stdout || | ||
options.outStream === process.stderr) prog.on('end', callback); | ||
else put.on('finish', callback); | ||
@@ -403,2 +413,25 @@ if (options.type === 'list') { | ||
} | ||
function closingTime(src, dst, callback) { | ||
var q = queue(); | ||
if (typeof src.close === "function") q.defer(function(next) { | ||
src.close(function(err) { | ||
if (err) return callback(err); | ||
next(); | ||
}); | ||
}); | ||
if (typeof dst.close === "function") q.defer(function(next) { | ||
dst.close(function(err) { | ||
if (err) return callback(err); | ||
next(); | ||
}); | ||
}); | ||
q.await(function(err) { | ||
if (err) return callback(err); | ||
callback(); | ||
}); | ||
} | ||
}; | ||
@@ -405,0 +438,0 @@ |
{ | ||
"name": "tilelive", | ||
"version": "5.6.3", | ||
"version": "5.7.0", | ||
"main": "./lib/tilelive.js", | ||
@@ -5,0 +5,0 @@ "description": "API for various map tile backends", |
Sorry, the diff of this file is not supported yet
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
63977
1145
16