1.3.0 • Published 2 years ago

pastebin-ts v1.3.0

Weekly downloads
80
License
MIT
Repository
github
Last release
2 years ago

pastebin-ts

NPM Libraries.io dependency status for GitHub repo master npm version npm Code Climate codecov

Typescript version of the Pastebin API client

Features

  • getPaste : get a raw paste
  • createAPIuserKey : get a userkey for the authenticated user
  • listUserPastes : get a list of the pastes from the authenticated user
  • getUserInfo : get a list of info from the authenticated user
  • listTrendingPastes : get a list of the trending pastes on Pastebin
  • createPaste : create a paste
  • createPasteFromFile : read a file (UTF8) and paste it
  • deletePaste : delete a paste created by the user

Example

const PastebinAPI = require('pastebin-ts');

const pastebin = new PastebinAPI({
    'api_dev_key' : 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'api_user_name' : 'PastebinUserName',
    'api_user_password' : 'PastebinPassword'
});

pastebin
    .createPasteFromFile({
        'file': './uploadthistopastebin.txt',
        'title': 'pastebin-js test'
    })
    .then((data) => {
        // we have successfully pasted it. Data contains the id
        console.log(data);
    })
    .catch((err) => {
        console.log(err);
    });