Install Deno, see https://deno.land/manual/getting_started/installation
Run ./sfz2sf.sh with the path of the SingleFileZ page as first parameter
Install Deno, see https://deno.land/manual/getting_started/installation
Run ./sfz2sf.sh with the path of the SingleFileZ page as first parameter
| import { extract } from "https://raw.githubusercontent.com/gildas-lormeau/single-filez-core/main/processors/compression/compression-extract.js"; | |
| import * as zip from "https://raw.githubusercontent.com/gildas-lormeau/zip.js/master/index.js"; | |
| globalThis.zip = zip; | |
| const { docContent } = await extract(new Blob([await Deno.readFile(Deno.args[0])]), { noBlobURL: true }); | |
| if (Deno.args[1]) { | |
| await Deno.writeTextFile(Deno.args[1], docContent); | |
| } else { | |
| console.log(docContent); | |
| } |
| #!/bin/sh | |
| if [ $# -eq 0 ]; then | |
| echo | |
| echo " Usage: $0 <INPUT FILE> [OUTPUT FILE]" | |
| echo | |
| echo " Transforms a page saved with SingleFileZ into a SingleFile page." | |
| echo | |
| echo " Arguments:" | |
| echo | |
| echo " INPUT FILE: path to a file containing a page saved with SingleFileZ" | |
| echo " OUTPUT FILE: path of the output file" | |
| echo | |
| exit 1 | |
| else | |
| deno run --allow-read --allow-write ./sfz2sf.js "$1" "$2" | |
| fi |
This is equivalent batch script for windows, if anyone needs:
Edit: Fixed input filenames with spaces.
@echo off
if "%~1" == "" (
echo Usage: %0 ^<INPUT FILE^> [OUTPUT FILE]
echo Transforms a page saved with SingleFileZ into a SingleFile page.
echo Arguments:
echo INPUT FILE: path to a file containing a page saved with SingleFileZ
echo OUTPUT FILE: path of the output file
exit /b 1
) else (
deno run --allow-read --allow-write .\sfz2sf.js "%~1" "%~2"
)It expects SFZ with .zip.html extension as input and save them as SF with .html extension with same filename, removing the option to give output filename. Also updating %1 with %~1, as it was giving error with filenames having space, so latter fixes that.
@echo off
if "%~1" == "" (
echo Usage: %0 ^<INPUT FILE^>
echo Transforms a page saved with SingleFileZ into a SingleFile page.
echo Arguments:
echo INPUT FILE: path to a file containing a page saved with SingleFileZ
exit /b 1
) else (
deno run --allow-read --allow-write .\sfz2sf.js "%~1"
)import { extract } from "https://raw.githubusercontent.com/gildas-lormeau/single-filez-core/main/processors/compression/compression-extract.js";
import * as zip from "https://raw.githubusercontent.com/gildas-lormeau/zip.js/master/index.js";
globalThis.zip = zip;
const { docContent } = await extract(new Blob([await Deno.readFile(Deno.args[0])]), { noBlobURL: true });
await Deno.writeTextFile(Deno.args[0].split(".")[0].concat(".html"), docContent);Thank you very much @nitincodery!
The File
compression-extract.jsis not available at that path.