Comparing version 0.5.1 to 1.0.0
38
index.js
@@ -360,3 +360,5 @@ 'use strict'; | ||
r = req(client.documentsURL + '/' + id, requestOptions, handler); | ||
r.end(JSON.stringify(data)); | ||
data = JSON.stringify(data); | ||
r.setHeader('content-length', data.length); | ||
r.end(data); | ||
return r; | ||
@@ -450,2 +452,5 @@ }, | ||
source.resume(); | ||
cached.pause(); | ||
source.pipe(file); | ||
@@ -462,3 +467,4 @@ source.pipe(cached); | ||
} else { | ||
if (source.path) { | ||
if (source.hasOwnProperty('fd')) { | ||
file.fd = cached.fd = source.fd; | ||
file.path = cached.path = source.path; | ||
@@ -506,2 +512,3 @@ } | ||
params, | ||
data = '', | ||
retry = false, | ||
@@ -538,3 +545,6 @@ requestOptions = { | ||
r = req(client.documentsURL, requestOptions, handler); | ||
r.end(JSON.stringify(params)); | ||
data = JSON.stringify(params); | ||
r.setHeader('content-length', data.length); | ||
r.end(data); | ||
return r; | ||
@@ -581,9 +591,3 @@ }, | ||
url = client.documentsURL + '/' + id + '/content' + extension; | ||
var r = req(url, handler); | ||
r.on('request', function (re) { | ||
if (re.xhr) { | ||
re.xhr.responseType = 'arraybuffer'; | ||
} | ||
}); | ||
return r; | ||
return req(url, handler); | ||
}, | ||
@@ -630,9 +634,3 @@ | ||
url = client.documentsURL + '/' + id + '/thumbnail?' + query; | ||
var r = req(url, handler); | ||
r.on('request', function (re) { | ||
if (re.xhr) { | ||
re.xhr.responseType = 'arraybuffer'; | ||
} | ||
}); | ||
return r; | ||
return req(url, handler); | ||
} | ||
@@ -660,2 +658,3 @@ }; | ||
params, | ||
data = '', | ||
retry = false, | ||
@@ -692,3 +691,6 @@ requestOptions = { | ||
r = req(client.sessionsURL, requestOptions, handler); | ||
r.end(JSON.stringify(params)); | ||
data = JSON.stringify(params); | ||
r.setHeader('content-length', data.length); | ||
r.end(data); | ||
return r; | ||
@@ -695,0 +697,0 @@ } |
{ | ||
"name": "box-view", | ||
"version": "0.5.1", | ||
"version": "1.0.0", | ||
"description": "A node client for the Box View API", | ||
@@ -36,3 +36,3 @@ "main": "index.js", | ||
"form-data": "^0.1.4", | ||
"hyperquest": "https://github.com/lakenen/hyperquest/tarball/emit-request" | ||
"hyperquest": "^0.3.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
@@ -46,4 +46,6 @@ [![Build Status](https://travis-ci.org/lakenen/node-box-view.png?branch=master)](https://travis-ci.org/lakenen/node-box-view) | ||
```js | ||
client.documents.list(function (err, body, res) { | ||
console.log(body) | ||
client.documents.list(function (err, list, res) { | ||
// `list` is the JSON-parsed response body | ||
// `res` is the HTTP Response object | ||
console.log(list); | ||
}); | ||
@@ -70,3 +72,5 @@ ``` | ||
client.documents.get('some document id', function (err, doc, res) { | ||
console.log(doc) | ||
// `doc` is the JSON-parsed response body | ||
// `res` is the HTTP Response object | ||
console.log(doc); | ||
}); | ||
@@ -162,2 +166,3 @@ ``` | ||
// `res` is the HTTP Response object | ||
res.pipe(fs.createWriteStream('./doc.zip')); | ||
@@ -190,2 +195,3 @@ }); | ||
// `res` is the HTTP Response object | ||
res.pipe(fs.createWriteStream('./thumbnail.png')); | ||
@@ -192,0 +198,0 @@ }); |
@@ -14,2 +14,4 @@ var TOKEN = process.env.BOX_VIEW_API_TOKEN; | ||
client.documentsUploadURL = process.env.BOX_VIEW_DOCUMENTS_UPLOAD_URL || client.documentsUploadURL; | ||
test('documents.uploadFile should upload the given file when called with a filename', function (t) { | ||
@@ -16,0 +18,0 @@ t.plan(2); |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
74096
1
227
0
5
+ Addedduplexer@0.1.2(transitive)
+ Addedhyperquest@0.3.0(transitive)
+ Addedthrough@2.2.7(transitive)
Updatedhyperquest@^0.3.0