Running a script with dependencies offline


#1

Hi everyone,

I would like to get the following script…

…running on a device that will be permanently offline. I assume I need to copy both this script and it’s dependencies but any advice would be appreciated.

Thanks,

Zeroth


#2
  1. Go to the page on RunKit and click the “download this notebook” button
  2. Open the .zip file from an Internet-connected computer with Node installed
  3. Run npm install inside the expanded zip folder
  4. Move the folder to the offline computer.

This should work since you don’t require() any other notebooks.


#3

Great thanks, I’ll try this tomorrow :slight_smile:


#4

Hi again,

Sorry for the delayed response. This seemed to work but now I don’t know how to actually run the script. I tried including the JS file in an HTML file and running in the browser, but I can’t get the baddr_to_taddr function to do anything…

Thanks,

Zeroth


#5

You have to install Node on the non-Internet-connected computer, then run node ..


#6

Sorry again, I have node installed, and the npm install has worked so I now have folders like lib, node_modules etc… lib seems to have the important JS file in it. So what do I put after “node”… and which folder should I be in? Sorry, bit out of my depth here but really want to get it working. Thanks for the help :slight_smile:


#7

I’ve entered a BTC address at the bottom of the JS file, and I’m running “node baddr2taddr.js” but it’s giving a TypeError at the line “return bs58check.encode(Buffer.from(taddr));”


#8

I got it working, thanks! :smiley: