0.0.4 • Published 3 years ago

armutable v0.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

armutable

Mutability on arweave

install

$ npm i armutable

usage

const armutable = require('armutable');
const fs = require('fs');
const arweave = require('arweave').init();

let jwk = JSON.parse(
    fs.readFileSync('keyfile.json').toString()
);

// create a new "thread"
let myFile = fs.readFileSync('myfile.txt').toString();
armutable.newThread(arweave, myFile, jwk).then((result) => {
    console.log(result);
    // returns txID
});

// create a thread from a file already on arweave
let txid = "itloICInyOpUhUVMhgmWiHz7toruQ3xnlh14eC7bEOQ";
armutable.threadFromTX(arweave, txid, jwk).then((result) => {
    console.log(result);
    // new txID is the armutable thread
});

// update a thread
txid = "mvykkO-gle5AMLiGOcCi7i5BkbFWTs5XuM2gPh7BM4k";
let newfile = `function hello(){
    console.log('this line has changed');
}`
armutable.updateThread(arweave, txid, newfile, jwk).then((result) => {
    console.log(result);
});

// read a thread (using the `init` transaction ID)
armutable.readThread(arweave, txid).then((result) => {
    console.log(result);
});

// allow another address to write changes
let address = "xEWtx87rhpoY-41RISu-i3GB7oNmsQWFQKUFNfl13bU";
armutable.authorizeAddress(arweave, txid, address, jwk).then((result) => {
    // returns txid
    console.log(result);
})
0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago