Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
A node client for the Box View API
npm install box-view
Create a client:
var myKey = process.env.BOX_VIEW_API_TOKEN;
var client = require('box-view').createClient(myKey);
See the Box View API Documentation for a list of available endpoints and their parameters.
client.documents.list(options, callback)
Fetch a list of documents uploaded using this API key.
[options]
- (object
) An optional set of options for the request
[options.params]
- (object
) An optional map of URL parameters for filtering documents[options.params.limit]
- (int
) The number of documents to return (default: 10, max: 50)[options.params.created_before]
- (Date
) An upper limit on the creation timestamps of documents returned (default: now)[options.params.created_after]
- (Date
) A lower limit on the creation timestamps of documents returned[options.retry]
- (boolean
) Whether to retry the request after retry-after
seconds if the retry-after header is sent (default: false
)[callback]
- (Function
) A callback to call with the following arguments:
null
Example:
client.documents.list(function (err, list, res) {
// `list` is the JSON-parsed response body
// `res` is the HTTP Response object
console.log(list);
});
client.documents.get(id, options, callback)
Fetch the metadata for a single document.
id
- (string
) The document uuid[options]
- (object
) An optional set of options for the request
[options.fields]
- (Array
or string
) An optional array or comma-separated list of fields to return (e.g., ['name', 'status']
or 'name,status'
); id and type are always returned[options.retry]
- (boolean
) Whether to retry the request after retry-after
seconds if the retry-after header is sent (default: false
)[callback]
- (Function
) A callback to call with the following arguments:
null
Example:
client.documents.get('some document id', function (err, doc, res) {
// `doc` is the JSON-parsed response body
// `res` is the HTTP Response object
console.log(doc);
});
client.documents.update(id, data, options, callback)
Update the metadata for a single document.
id
- (string
) The document uuiddata
- (object
) The new metadata (currently only name
is supported)[options]
- (object
) An optional set of options for the request
[options.retry]
- (boolean
) Whether to retry the request after retry-after
seconds if the retry-after header is sent (default: false
)[callback]
- (Function
) A callback to call with the following arguments:
null
client.documents.delete(id, options, callback)
Delete a single document.
id
- (string
) The document uuid[options]
- (object
) An optional set of options for the request
[options.retry]
- (boolean
) Whether to retry the request after retry-after
seconds if the retry-after header is sent (default: false
)[callback]
- (Function
) A callback to call with the following arguments:
null
client.documents.uploadFile(file, options, callback)
Do a multipart upload.
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[options]
- (object
) An optional set of options for the request
[options.params]
- (object
) An optional map of upload parameters[options.params.name]
- (string
) The name of the file. If options.params.name
is not set, it will be inferred from the file path.[options.params.thumbnails]
- (string
) Comma-separated list of thumbnail dimensions of the format {width}x{height}
(e.g. '128×128,256×256'
) – width can be between 16 and 1024, height between 16 and 768[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
)[callback]
- (Function
) A callback to call with the following arguments:
null
client.documents.uploadURL(url, options, callback)
Do a URL upload of a file.
[url]
- (string
) A URL to a publicly-accessible file to upload[options]
- (object
) An optional set of options for the request
[options.params]
- (object
) An optional map of upload parameters[options.params.name]
- (string
) The name of the file. If options.params.name
is not set, it will be inferred from the URL.[options.params.thumbnails]
- (string
) Comma-separated list of thumbnail dimensions of the format {width}x{height}
(e.g. '128×128,256×256'
) – width can be between 16 and 1024, height between 16 and 768[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
)[callback]
- (Function
) A callback to call with the following arguments:
null
client.documents.getContent(id, options, callback)
Fetch a document of a specified format.
id
- (string
) The document uuid[options]
- (object
) An optional set of options for the request
[options.extension]
- (string
) Optional document format to request ('pdf'
or 'zip'
). If excluded, the original document format will be returned.[options.retry]
- (boolean
) Whether to retry the request after retry-after
seconds if the retry-after header is sent (default: false
)[callback]
- (Function
) A callback to call with the following arguments:
null
Example:
client.documents.getContent(id, { extension: 'zip' }, function (err, res) {
if (err) {
console.error(err);
return;
}
// `res` is the HTTP Response object
res.pipe(fs.createWriteStream('./doc.zip'));
});
client.documents.getThumbnail(id, width, height, options, callback)
Fetch a thumbnail for the given document id.
id
- (string
) The document uuidwidth
- (int
) The thumbnail widthheight
- (int
) The thumbnail height[options]
- (object
) An optional set of options for the request
[options.retry]
- (boolean
) Whether to retry the request after retry-after
seconds if the retry-after header is sent (default: false
)[callback]
- (Function
) A callback to call with the following arguments:
null
Example:
client.documents.getThumbnail(id, params, function (err, res) {
if (err) {
console.error(err);
return;
}
// `res` is the HTTP Response object
res.pipe(fs.createWriteStream('./thumbnail.png'));
});
client.sessions.create(id, options, callback)
Request a viewing session for a document.
[id]
- (string
) The document uuid[options]
- (object
) An optional set of options for the request
[options.params]
- (object
) An optional map of session parameters[options.params.duration]
- (int
) The duration in minutes until the session expires (default: 60)[options.params.expires_at]
- (Date
) The timestamp at which the session should expire[options.params.is_downloadable]
- (boolean
) Whether the original file will be available for download via GET /sessions/{id}/content while the session is active[options.retry]
- (boolean
) Whether to retry the request after retry-after
seconds if the retry-after header is sent (default: false
)[callback]
- (Function
) A callback to call with the following arguments:
null
Make sure you have the development dependencies installed by running npm install
, then you should be able to run the tests with npm test
.
Copyright 2014 Cameron Lakenen
FAQs
A node client for the Box View API
The npm package box-view receives a total of 41 weekly downloads. As such, box-view popularity was classified as not popular.
We found that box-view demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.