This is a TypeScript declaration file generator for libsodium.js
0.7.3.
The types for version 0.7.3 were merged to DefinitelyTyped and published on npm. Other versions are not supported (yet).
yarn global add libsodium-type-generator
or
npm install -g libsodium-type-generator
Usage: libsodium-type-generator [options]
Options:
-V, --version output the version number
-o, --output <file|dir> Specify the output file or directory (required)
-b, --base <path> Specify the libsodium.js base path
-s, --sumo Generate types for the sumo version
-h, --help output usage information
curl -L https://github.com/jedisct1/libsodium.js/archive/master.tar.gz -o /path/to/libsodium.tar.gz
tar -C /path/to/ -zxvf /path/to/libsodium.tar.gz
libsodium-type-generator -o /path/to/libsodium.d.ts -b /path/to/libsodium.js-master/
or
libsodium-type-generator -o /path/to/libsodium.d.ts
# source will be downloaded from GitHub and saved to a temp folder
import TypeGenerator from 'libsodium-type-generator';
const generator = new TypeGenerator('/path/to/outputfile');
generator
.generate()
.then(outputFile => {
// success!
console.log(outputFile); // /path/to/outputfile
})
.catch(error => {
// handle error
});