Comparing version 1.2.1 to 2.0.0
28
index.js
@@ -409,4 +409,2 @@ 'use strict'; | ||
form, | ||
source, | ||
cached, | ||
handler, | ||
@@ -442,27 +440,5 @@ params, | ||
// if the file is a stream, we need to duplicate it | ||
// if the file is a stream, we cannot retry | ||
if (retry && file.readable) { | ||
source = file; | ||
cached = new PassThrough(); | ||
file = new PassThrough(); | ||
source.resume(); | ||
cached.pause(); | ||
source.pipe(file); | ||
source.pipe(cached); | ||
args[0] = cached; | ||
// copy relevant properties to the new stream objects | ||
if (source.hasOwnProperty('httpVersion')) { | ||
file.httpVersion = cached.httpVersion = source.httpVersion; | ||
file.headers = cached.headers = source.headers; | ||
file.client = cached.client = source.client; | ||
} else { | ||
if (source.hasOwnProperty('fd')) { | ||
file.fd = cached.fd = source.fd; | ||
file.path = cached.path = source.path; | ||
} | ||
} | ||
throw new Error('Retry option is not supported for streams.'); | ||
} | ||
@@ -469,0 +445,0 @@ |
{ | ||
"name": "box-view", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "A node client for the Box View API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -112,2 +112,4 @@ [![Build Status](https://travis-ci.org/lakenen/node-box-view.png?branch=master)](https://travis-ci.org/lakenen/node-box-view) | ||
**NOTE: the `retry` option is not supported for multipart uploads (uploads specified via string filename or Stream.** | ||
* `file` - (`string` or `stream.Readable` or `File` or `Buffer`) A path to a file to read, a readable stream, a File object (e.g., in a browser), or a Buffer | ||
@@ -119,3 +121,3 @@ * `[options]` - (`object`) An optional set of options for the request | ||
* `[options.params.non_svg]` - (`boolean`) Whether to also create the non-svg version of the document | ||
* `[options.retry]` - (`boolean`) Whether to retry the request after `retry-after` seconds if the retry-after header is sent (default: `false`) | ||
* `[options.retry]` - (`boolean`) Whether to retry the request after `retry-after` seconds if the retry-after header is sent (default: `false`). *See above note about retry support for streams.* | ||
* `[callback]` - (`Function`) A callback to call with the following arguments: | ||
@@ -122,0 +124,0 @@ * an error object or `null` |
@@ -11,3 +11,3 @@ var TOKEN = process.env.BOX_VIEW_API_TOKEN; | ||
params: {}, | ||
retry: true | ||
retry: false | ||
}; | ||
@@ -14,0 +14,0 @@ |
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
252
77590
1147