| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This script will take a path to any local file and attempt to upload it to a BookStack page as an attachment using the API using a multipart/form-data request.
This is a simplistic example of a NodeJS script. You will likely want to alter and extend this script to suit your use-case.
You will need NodeJS installed (Tested on v16, may work on earlier versions).
First, download all the files in the same directory as this readme to a folder on your system and run the below from within that directory.
# Install NodeJS dependencies via NPM
npm install
# Setup
# ALTERNATIVELY: Open the script and add to the empty strings in the variables at the top.
export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL
export BS_TOKEN_ID=abc123 # Set to be your API token_id
export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
# Running the script
node index.js <page_id> <file_path># Upload the 'cat-image-collection.zip' file as an attachment to page of ID 205
node index.js 205 ./cat-image-collection.zip| Back | FazBrowse Home | New Git URL |