Catalog npm
PACKAGE EXPLORERView in registry

1mbsite-node

npm

NodeJS Library for interacting with the 1MB API

Versions collected4
Direct dependencies2From release 1.0.3
Last observed20 Oct, 18:33 UTC

README

Current package documentation

1mbsite NodeJS Version Weekly Downloads Licence

1mbsite NodeJS is an NPM package built to communicate with the 1mbsite API.

Note: No functions in this package are synchronous, they all have callback parameters which are run when the request package returns data

Getting Started

Before you begin, you must install the NPM package by executing the following command:

npm install 1mbsite-node --save

When using this API you will need to provide your 1mbsite account key, you can obtain your account key by logging in here and clicking the API category in the settings. There you should see your account key.

Once you have this done, you can require 1mbsite-node by doing the following:

const mbsite = require("1mbsite-node");

After requiring the 1mbsite-node library you need to create a new API instance by doing the following:

const API = mbsite.API;

Now you are ready to use the API.

Examples

Verifying your API key

Note: This process is not required as this method is called in the constructor of the API class.

API.verifyKey(function(result){
// Code here will be executed when the request has returned data
});

The verifyKey() method requires a callback parameter. A JSON object is passed through the callback and has an "error" key and a "data key". The data key here is unused but the error key will be true on success, or an error string on failure.

Deploying to your 1mb.site

API.deploy("resource", "code", function(result){
// Code here will be executed when the request has returned data
});

The deploy() method requires a string parameter for the resource you want to deploy to, another string parameter for the code you want to deploy and a callback parameter. The callback parameter passes through a JSON object which has the keys "error" and "data". Once again, the data key is unused but the error key either returns true on success, or an error string on failure.

Viewing a 1mb.site resource

API.viewSite("site name", "resource", function(result){
// Code here will be executed when the request has returned data
});

The viewSite() method requires a string parameter for the site name (a username), another string parameter for the resource you want to view and a callback parameter. The callback parameter passes through a JSON object with the keys "error" and "data". If there are no errors, the error key will be false and the data key will be a string of the code of the provided resource. If there is an error, the error will be a string error and the data key will be false.

Listing a sites resources

API.listResources("site name", function(result){
// Code here will be executed when the request has returned data
});

The listResources() method requires a string parameter for the site name (a username) and a callback parameter. The callback parameter passes through a JSON object with the keys "error" and "data". If there is an error, the error key will be an error string, but if there is no error, error will be false and the data key will be an array with all the resources on a site.

API made with :heart: by TwistedAsylumMC!

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 4

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.3Registry latest24 Mar 20192
1.0.220 Mar 20192
1.0.120 Mar 20192
1.0.020 Mar 20192

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
twistedasylummc/1mbsite-node

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:33 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:63ba7033c9937f1eb5578a0f2093a1844b7465fc63115a00e0cc477ee1b9c081