PageSourceSearch

https://bitje.de/Go/js/CSaveFile.js

js bitje.de collected 2026-10-02 19:19:22 UTC 1,367 bytes, 40 lines download raw bytes

1//-------------------------------------------------------------------------------------------------
2//	This module needs:
3//		FileSaver.min.js
4//		tools.js			// for the BOM constant ("\uFEFF")
5//-------------------------------------------------------------------------------------------------
6//	Ways to write a file:
7//		https://code-boxx.com/create-save-files-javascript/
8//-------------------------------------------------------------------------------------------------
9class CSaveFile
10{
11	//---------------------------------------------------------------------------------------------
12	//	saveAs( blob, sFileName, { autoBom: true } );	// bug: autoBom has no effect (2022-02-22)
13	
14	static Text( sFileName, sText, boolBom=1 )
15	{
16		const blob = new Blob( [ boolBom ? S_BOM + sText : sText ], { type: "text/plain; charset=utf-8" } );
17		saveAs( blob, sFileName );
18	}
19}
20//-------------------------------------------------------------------------------------------------
21/*
22<!DOCTYPE html>
23<HTML>
24<HEAD>
25
26</HEAD>
27<BODY>
28
29<script src="./js/tools.js"></script>
30<script src="./js/FileSaver.min.js"></script>
31<script src="./js/CSave.js"></script>
32
33<script>
34	CSave.Text( "Test - with BOM.txt",	"Hello, world - ödester aller häßlichen Plätze!"	);
35	CSave.Text( "Test - no BOM.txt",	"Hello, world - ödester aller häßlichen Plätze!", 0 );
36</script>
37
38</BODY>
39</HTML>
40*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.