
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
digital-ocean-api
Advanced tools
A thin wrapper for the Digital Ocean API (v2)
First get the package through NPM
npm install digital-ocean-api
Now set it up inside your application
var DigitalOceanApi = require('digital-ocean-api');
var api = new DigitalOceanApi({
token: 'yourAccessToken'
});
All the methods utilize the same callback interface, except for the Paginator getPageRange method.
function(error, data) {};
Errors are created internally following the following pattern:
var error = new Error('message');
error.code = 'string_coded_error';
error.original = errorObject; // if applicable
These are the top-level errors (every callback can be return these errors)
When a method accesses a paginated resource, you can pass along a callback and exhaust the entire resource, or you don't provide a callback in which you will get an instance of Paginator, a helper utility to more easily work with multi- page resources.
var paginator = api.listDroplets();
The paginator implements the following methods:
The getPageRange is the only method to access the api inside this library which does not respect the same callback interface. Since it's an asynchronous function it will call the callback whenver it gets back results from a page. The order is rather random and as such it's important to provide an easy-to-use api to find out which page it is.
paginator.getPageRange(1, 5, function(error, data, page) {
});
Droplet actions always have a boolean and callback as it's last two arguments.
API.prototype.rebuildDroplet = function(id, image, tagged, callback)
If the tagged boolean is true, the id argument will be used as a tag instead and the action will be performed against all droplets with the specified tag. In that case, the result will be an array of actions.
The "tagged" argument is optional for the sake of backwards compatibility.
Refer to the actual API Documentation to learn what the returned values can be. Bear in mind that the returned data is sanitized.
Methods marked with a star (*) are paginated methods.
api.getUserInfo(function(err, info) {
});
// Exhaustive call (not recommended here)
api.listActions(function(err, actions) {
});
// Paginator object
var paginator = api.listActions();
api.getAction(id, function(err, action) {
})
// Exhaustive call
api.listDroplets(function(err, droplets) {
});
// Paginator object
var paginator = api.listDroplets();
// Exhaustive call (recommended)
api.listRegions(function(err, regions) {
});
// Paginator object
var paginator = api.listRegions();
// Exhaustive call (recommended)
api.listSizes(function(err, sizes) {
});
// Paginator object
var paginator = api.listSizes();
MIT
FAQs
A thin wrapper for the Digital Ocean API (v2)
The npm package digital-ocean-api receives a total of 2 weekly downloads. As such, digital-ocean-api popularity was classified as not popular.
We found that digital-ocean-api 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.