This program allows users to encode files to data URLs. All files will be stored in a javascript object called jsFiles. By default, the keys to the hash object are the file names, but you can rename these keys.
- Use the file uploader to upload files.
- Select a file in the dropdown,
- Change the name in the rename box,
- click "Update" to save the new name.
- Type the name of your base object, the files will be .jsFiles. This helps avoid collisions.
- Finally, click the save button to generate a download link, then right-click and save the file as .js. Note that the .js extension will likely not be added automatically, so be sure to add it.
To use the encoded files in your project:
- include the script you saved in the previous steps. Include it before you need it of course.
- To get a file's data url, use your-base-object.jsFiles["your-file-name"]
- If you feel lost, encode a small file with the previous steps, then look at the resulting script.
Thank you for using JS Files!