netstorageapi
Advanced tools
Comparing version 0.6.1 to 0.7.0
@@ -26,3 +26,3 @@ // Original author: Astin Choi <achoi@akamai.com> | ||
var Netstorage = function(hostname, keyname, key, ssl) { | ||
if (!hostname && !keyname && !key) { | ||
if (!(hostname && keyname && key)) { | ||
throw new Error('[Netstorage Error] You should input netstorage hostname, keyname and key all'); | ||
@@ -67,3 +67,4 @@ } | ||
'X-Akamai-ACS-Auth-Sign': acs_auth_sign, | ||
'Accept-Encoding': 'identity' | ||
'Accept-Encoding': 'identity', | ||
'User-Agent': 'NetStorageKit-Node' | ||
} | ||
@@ -199,7 +200,9 @@ }; | ||
try { | ||
if (fs.lstatSync(local_source).isDirectory()) { | ||
callback(error=new Error("[Netstorage Error] You should upload a file, not directory")); | ||
if (fs.statSync(local_source).isFile()) { | ||
if (ns_destination.endsWith('/')) { | ||
ns_destination = `${ns_destination}${path.basename(local_source)}`; | ||
} | ||
} else { | ||
callback(error=new Error("[Netstorage Error] You should upload a file")); | ||
return; | ||
} else if (ns_destination.endsWith('/')) { | ||
ns_destination = `${ns_destination}${path.basename(local_source)}`; | ||
} | ||
@@ -218,3 +221,2 @@ } catch (e) { | ||
module.exports = Netstorage; |
{ | ||
"name": "netstorageapi", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"description": "Akamai Netstorage API for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "./lib/netstorage.js", |
32559
406