Skip to content

Nateonus/WebGLFileSaverForUnity

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Nat's WebGL FileSaver

Use this plugin to download/save files from inside a WebGL Build. Built using the (MIT-licensed) FileSaver.js library, made by Eli Grey. (http://purl.eligrey.com/github/FileSaver.js )

This was created for https://nateonus.itch.io/natvox , an online Voxel Editor for Game Development. https://twitter.com/nateonus for updates.

Usage

The WebGLFileSaver class has two static functions to use:

  1. public static bool IsSavingSupported() This returns a boolean value of whether saving is supported on the current OS and Browser or not.

  2. public static void SaveFile(string content, string filename, string MIMEType) public static void SaveFile(byte[] content, string filename, string MIMEType) This prompts the user to download a file named 'filename', with the content 'content'. The MIMEType is the file type that will allow the browser to open the file with a default program. It can be set to any values in the IANA Media Types (https://www.iana.org/assignments/media-types/media-types.xhtml ) It's default is set to "text/plain;charset=utf-8" (a plain-text file). SaveFile will not run if saving is not supported.

Browser Support

To view which browsers are supported, visit https://github.com/eligrey/FileSaver.js#supported-browsers

About

A simple way of saving/downloading files from a WebGL build on Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published