npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@matterpool/bitcoinfiles-js

v1.0.0

Published

BitcoinFiles JS

Downloads

1

Readme

BitcoinFiles JS

Upload large files directly to Bitcoin.

Installation

npm install @matterpool/bitcoinfiles-js

JS Usage

Uploading and paying for a file

const bitcoinfiles = require('@matterpool/bitcoinfiles-js');

const workspaceId = '<insert-workspace-id>';
const file = new File(['foo', 'bar'], 'foobar.txt');
const formData = new FormData();
formData.append('file', file);

const upload = bitcoinfiles.upload(formData, workspaceId);

const paymentAddress = upload.payment_address;
const paymentSatoshis = upload.payment_satoshis;

// use paymentAddress and paymentSatoshis to pay for the file
// you can use any bitcoin wallet to pay for bitcoin files

const rawtx = '....'
const payment = await bitcoinfiles.pay(rawtx);
// save the transaction id of the file to download it later
const txid = payment.result[0].txid 

Downloading a File

const txid = '8f7090ec72a692e7bb893a3fd4ef1e508c655a284a5b736b3cc7c63649748562'
const file = await bitcoinfiles.download(txid);

API Usage

Upload

Request

POST https://api.bitcoinfiles.org?tag=<workspace-id>
Content-Type: multipart/form-data
Body:
  file: <file-contents>

Response

{
    payment_address: '18Qi1rXJSLDLUYDZVkRT3ZdyB3E9eZamY2',
    payment_satoshis: 2833,
    session_tag: '<workspace-id>',
    location: '<file-cdn-url>'
}

Pay

To pay for a file, pay payment_address the amount of payment_satoshis. You can pay for multiple files at once in the same transaction

Request

POST https://api.bitcoinfiles.org/pay
Content-Type: application/json
Body:
{
  rawtx: '<raw-transaction-hex>'
}

Response

{
    errors: [],
    status: 200,
    result: [{
        txid: 'f7a3e5838a134a78b6a5033aa928efb7849be6212307b9b9eed3c738ea470bc2',
        session_tag: '<workspace-id>',
        fileurl: '<file-cdn-url>',
        payment_address: '18Qi1rXJSLDLUYDZVkRT3ZdyB3E9eZamY2',
        payment_sats_needed: 2833,
        filesize: 2775,
        created_time: 1602905335,
        filename: '<filename>',
    }]
}

Download

You can download a file by using it's transaction id. This link can be used in html tags like <img>, <video> or <audio>

Request

GET https://media.bitcoinfiles.org/[txid]