Download spectrum/api/utils/base64.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 500 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/utils/base64.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/api/utils/base64.js
-
curl -L -o base64.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/utils/base64.js
500 Bytes
| // @flow | |
| /** | |
| * Encode a string to base64 (using the Node built-in Buffer) | |
| * | |
| * Stolen from http://stackoverflow.com/a/38237610/2115623 | |
| */ | |
| export const encode = (string: string) => | |
| Buffer.from(string).toString('base64'); | |
| type Base64String = string; | |
| /** | |
| * Decode a base64 string (using the Node built-in Buffer) | |
| * | |
| * Stolen from http://stackoverflow.com/a/38237610/2115623 | |
| */ | |
| export const decode = (string?: Base64String) => | |
| (string ? Buffer.from(string, 'base64').toString('ascii') : ''); | |