0.0.4 • Published 5 years ago

@krakaw/zip-text-replace v0.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

zip-text-replace

Unzip a file, replace text within a file and re-zip it.

let replaceDocx = new Replacer({
		input: {
			path: "./test_input.docx"
		},
		output: {
			name: "test_output.docx",
			writeFile: true
		},
		replace:{
			srcFiles: ["word/document.xml"],
			replacements: [
				{
					key: "{replace_me}",
					value: "My New Text",
					escapeKey: true
				}
			]
		}
	});
	replaceDocx.replace();

	let replacerXlsx = new Replacer({
		input: {
			path: "./test_input.xlsx"
		},
		output: {
			name: "test_output.xlsx",
			writeFile: false //Get a stream instead
		},
		replace:{
			srcFiles: ["xl/sharedStrings.xml"],
			replacements: [
				{
					key: "{replace_me}",
					value: "Another New String",
					escapeKey: true
				}
			]
		}

	});
  const stream = replacerXlsx.replace();
0.0.4

5 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago