Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 2.32 KB

README.md

File metadata and controls

68 lines (51 loc) · 2.32 KB

FastReplaceString

Fast native implementation in c(++) of a replace string script as an npm package. Replaces a string in a file.

Build status

Platform Status Notes
Linux Build status
MacOS Build Status
Windows Build status Use the precompiled binary available in .bin

Usage

fastreplacestring.exe filename src dest
  • filename: filename to read
  • src: string that will be replaced
  • dest: replacement

Example:

echo "let () = print_endline \"Hello world🌍\";" > hello.re

fastreplacestring.exe hello.re world🌍 universe⛄️

cat hello.re
 >>> let () = print_endline "Hello universe⛄️";

Tests:

# everything
npm run test

# default tests
node ./tests/test.js

# cross compiling tests
node ./tests/xtest.js

How to contribute:

  • clone the repo
  • add a new file under ./tests/input/yourFileName
  • add the expected file under ./tests/expected/yourFileName
  • add a command in ./tests/test.js of form filename src dest, e.g. yourFileName aString aReplacement
  • make changes to fastreplacestring.cpp & npm run build
  • npm run test

Notes on Cross-Compiling

Fastreplacestring.exe has been cross compiled from a Macbook Pro (13" intel i5 early 2015 macOS Sierra 10.12.5) to the following platforms:

OS ARCH Binary CI available
Linux 32 fastreplacestring-linux32.exe 🚫
64 fastreplacestring-linux64.exe
Windows 32 fastreplacestring-win32.exe
64 fastreplacestring-win64.exe 🚫
Darwin 32 fastreplacestring-darwin32.exe 🚫
64 fastreplacestring-darwin64.exe

All binaries are located in the .bin directory.