Package Exports
- @sheeptester/htmlifier
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sheeptester/htmlifier) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
HTMLifier for Node
Package a Scratch project inside an HTML file with no optimisations.
Installation
$ npm install @sheeptester/htmlifier
Example usage
The following example HTMLifies Scratch 3.0 is
here! and writes the result to a
file named index.html
.
import fs from 'fs/promises'
import Htmlifier from '@sheeptester/htmlifier'
async function main () {
const html = await new Htmlifier()
.htmlify({ type: 'id', id: '276660763' })
.then(blob => blob.text())
await fs.writeFile('./index.html', html)
}
main()
Because node-fetch
is strictly an
ES module, this package is also an ES module. If you're using a CommonJS module,
you can use esm
to import this package.
require = require('esm')(module)
const Htmlifier = require('@sheeptester/htmlifier')
The HTMLifier was primarily written for Deno and the web, so it uses
Blob
s and
File
s to pass binary
data around. You can use
fetch-blob
to create Blob
s and
File
s for the HTMLifier.
import Htmlifier from '@sheeptester/htmlifier'
import { fileFrom } from 'fetch-blob/from.js'
async function main () {
const html = await new Htmlifier()
.htmlify({ type: 'file', file: await fileFrom('./project.sb3') })
.then(blob => blob.text())
// ...
}
main()
Documentation
Auto-generated documentation is available courtesy of deno doc.