
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
itembase-document-stream
Advanced tools
Stream itembase documents. Handles pagination and refreshing the access token if necessary.
npm install itembase-document-stream
As a minimum the constructor requires the resource URL and a valid access token.
var itembase = require('itembase-document-stream');
var JSONStream = require('JSONStream');
itembase('/v1/users/:user_id/transactions', 'access_token')
.pipe(JSONStream.stringify())
.pipe(process.stdout);
It's also possible to pass more complex options.
var tokens = {
access_token: 'access_token',
refresh_token: 'refresh_token'
};
var options = {
client: { id: 'client_id', secret: 'client_secret' },
urls: { api: 'http://sandbox.api.itembase.io', accounts: 'http://sandbox.accounts.itembase.io' },
query: { document_limit: 10 }
};
var stream = itembase('/v1/users/:user_id/transactions', tokens, options);
stream.on('tokens', function(tokens) {
// Tokens have been refreshed
console.log(tokens);
});
stream.on('data', function(data) {
console.log(data);
});
The client
option, together with the refresh_token
, is necessary to be able to refresh the access token if it expires. Otherwise an error
event is emitted.
It's also possible to override the base URLs in the options map, and pass additional query parameters to the API request.
Additionally a start
event is emitted when the first request is performed. It contains, among other things, total number of documents to expect.
FAQs
Stream itembase documents
The npm package itembase-document-stream receives a total of 1 weekly downloads. As such, itembase-document-stream popularity was classified as not popular.
We found that itembase-document-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.