1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-05-12 08:00:12 +00:00

File I/O - part 3

This commit is contained in:
boxgaming 2022-10-28 14:58:21 -05:00
parent 9058e9c536
commit 9a95a4ab1b
18 changed files with 610 additions and 16 deletions

View file

@ -660,9 +660,18 @@ var GX = new function() {
_sounds[sid-1] = undefined;
}
function _soundLoad (filename) {
var a = new Audio(filename);
_sounds.push(a);
async function _soundLoad (filename) {
var file = _vfs.getNode(filename, _vfsCwd);
if (file && file.type == _vfs.FILE) {
var dataUrl = await _vfs.getDataURL(file);
var a = new Audio(dataUrl);
_sounds.push(a);
}
else {
var a = new Audio(filename);
_sounds.push(a);
}
return _sounds.length;
}
@ -895,7 +904,15 @@ var GX = new function() {
async function _mapLoad(filename) {
_map_loading = true;
var data = await _getJSON(filename);
var data = null;
var file = _vfs.getNode(filename, _vfsCwd);
if (file && file.type == _vfs.FILE) {
data = JSON.parse(_vfs.readText(file));
}
else {
data = await _getJSON(filename);
}
var parentPath = filename.substring(0, filename.lastIndexOf("/")+1);
var imagePath = data.tileset.image.substring(data.tileset.image.lastIndexOf("/")+1);
GX.tilesetCreate(parentPath + imagePath, data.tileset.width, data.tileset.height);

54
img/delete-hover.svg Normal file
View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 32 32"
version="1.1"
id="svg13"
sodipodi:docname="delete-hover.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview15"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="29.90625"
inkscape:cx="16.016719"
inkscape:cy="16.016719"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg13" />
<defs
id="defs4">
<style
id="style2">.cls-1{fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style>
</defs>
<title
id="title6" />
<line
class="cls-1"
x1="7"
x2="25"
y1="7"
y2="25"
id="line8"
style="stroke:#cccccc;stroke-opacity:1" />
<line
class="cls-1"
x1="7"
x2="25"
y1="25"
y2="7"
id="line10"
style="stroke:#cccccc;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

54
img/delete.svg Normal file
View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 32 32"
version="1.1"
id="svg13"
sodipodi:docname="delete.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview15"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="29.90625"
inkscape:cx="16.016719"
inkscape:cy="16.016719"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg13" />
<defs
id="defs4">
<style
id="style2">.cls-1{fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style>
</defs>
<title
id="title6" />
<line
class="cls-1"
x1="7"
x2="25"
y1="7"
y2="25"
id="line8"
style="stroke:#666666;stroke-opacity:1" />
<line
class="cls-1"
x1="7"
x2="25"
y1="25"
y2="7"
id="line10"
style="stroke:#666666;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 723 B

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 723 B

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

62
img/new-folder-hover.svg Normal file
View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
fill="none"
height="24"
viewBox="0 0 29 24"
width="29"
version="1.1"
id="svg5602"
sodipodi:docname="new-folder-hover.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs5606" />
<sodipodi:namedview
id="namedview5604"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="39.875"
inkscape:cx="14.495298"
inkscape:cy="12.012539"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg5602" />
<path
d="M6.46501 9H25.1243C26.4323 9 27.3883 10.235 27.0604 11.5013L24.0831 23H1.29191L4.52886 10.4987C4.75733 9.61629 5.55352 9 6.46501 9Z"
stroke="black"
stroke-width="2"
id="path5594"
style="stroke:#cccccc;stroke-opacity:1" />
<path
d="M24 23H1V5.86957C1 4.765 1.89543 3.86957 3 3.86957H4.83333L6.15611 1.88915C6.52719 1.33359 7.15116 1 7.81924 1H12.3891C13.0572 1 13.6811 1.33359 14.0522 1.88915L15.375 3.86957H22C23.1046 3.86957 24 4.765 24 5.86957V9"
stroke="black"
stroke-width="2"
id="path5596"
style="stroke:#cccccc;stroke-opacity:1" />
<path
d="M15 13V19"
stroke="black"
stroke-linecap="round"
stroke-width="2"
id="path5598"
style="stroke:#cccccc;stroke-opacity:1" />
<path
d="M12 16H18"
stroke="black"
stroke-linecap="round"
stroke-width="2"
id="path5600"
style="stroke:#cccccc;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

62
img/new-folder.svg Normal file
View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
fill="none"
height="24"
viewBox="0 0 29 24"
width="29"
version="1.1"
id="svg5602"
sodipodi:docname="new-folder.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs5606" />
<sodipodi:namedview
id="namedview5604"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="39.875"
inkscape:cx="14.495298"
inkscape:cy="12.012539"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg5602" />
<path
d="M6.46501 9H25.1243C26.4323 9 27.3883 10.235 27.0604 11.5013L24.0831 23H1.29191L4.52886 10.4987C4.75733 9.61629 5.55352 9 6.46501 9Z"
stroke="black"
stroke-width="2"
id="path5594"
style="stroke:#666666;stroke-opacity:1" />
<path
d="M24 23H1V5.86957C1 4.765 1.89543 3.86957 3 3.86957H4.83333L6.15611 1.88915C6.52719 1.33359 7.15116 1 7.81924 1H12.3891C13.0572 1 13.6811 1.33359 14.0522 1.88915L15.375 3.86957H22C23.1046 3.86957 24 4.765 24 5.86957V9"
stroke="black"
stroke-width="2"
id="path5596"
style="stroke:#666666;stroke-opacity:1" />
<path
d="M15 13V19"
stroke="black"
stroke-linecap="round"
stroke-width="2"
id="path5598"
style="stroke:#666666;stroke-opacity:1" />
<path
d="M12 16H18"
stroke="black"
stroke-linecap="round"
stroke-width="2"
id="path5600"
style="stroke:#666666;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

37
img/refresh-hover.svg Normal file
View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="32px"
id="Layer_1"
style="enable-background:new 0 0 32 32;"
version="1.1"
viewBox="0 0 32 32"
width="32px"
xml:space="preserve"
sodipodi:docname="refresh-hover.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs9862" /><sodipodi:namedview
id="namedview9860"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="29.90625"
inkscape:cx="16.016719"
inkscape:cy="16.016719"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><path
d="M28,16c-1.219,0-1.797,0.859-2,1.766C25.269,21.03,22.167,26,16,26c-5.523,0-10-4.478-10-10S10.477,6,16,6 c2.24,0,4.295,0.753,5.96,2H20c-1.104,0-2,0.896-2,2s0.896,2,2,2h6c1.104,0,2-0.896,2-2V4c0-1.104-0.896-2-2-2s-2,0.896-2,2v0.518 C21.733,2.932,18.977,2,16,2C8.268,2,2,8.268,2,16s6.268,14,14,14c9.979,0,14-9.5,14-11.875C30,16.672,28.938,16,28,16z"
id="path9857"
style="stroke:none;stroke-opacity:1;fill:#cccccc;fill-opacity:1" /></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 900 B

37
img/refresh.svg Normal file
View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="32px"
id="Layer_1"
style="enable-background:new 0 0 32 32;"
version="1.1"
viewBox="0 0 32 32"
width="32px"
xml:space="preserve"
sodipodi:docname="refresh.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs9862" /><sodipodi:namedview
id="namedview9860"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="29.90625"
inkscape:cx="16.016719"
inkscape:cy="16.016719"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><path
d="M28,16c-1.219,0-1.797,0.859-2,1.766C25.269,21.03,22.167,26,16,26c-5.523,0-10-4.478-10-10S10.477,6,16,6 c2.24,0,4.295,0.753,5.96,2H20c-1.104,0-2,0.896-2,2s0.896,2,2,2h6c1.104,0,2-0.896,2-2V4c0-1.104-0.896-2-2-2s-2,0.896-2,2v0.518 C21.733,2.932,18.977,2,16,2C8.268,2,2,8.268,2,16s6.268,14,14,14c9.979,0,14-9.5,14-11.875C30,16.672,28.938,16,28,16z"
id="path9857"
style="stroke:none;stroke-opacity:1;fill:#666666;fill-opacity:1" /></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -53,10 +53,12 @@
<div id="warning-container"></div>
<div id="js-code"></div>
<div id="fs-browser">
<div id="fs-path"><span id="fs-url">/</span><img id="fs-refresh" src="refresh.png" title="Refresh" onclick="refreshFS()"/></div>
<div id="fs-path">
<span id="fs-url">/</span>
<div id="fs-refresh" title="Refresh" onclick="refreshFS()"></div>
<div id="fs-new-folder" title="New Directory" onclick="onNewDirectory()"></div>
</div>
<div id="fs-contents">
<a class="fs-dir">..</a>
<a class="fs-file">test.txt</a>
</div>
</div>
</div>

View file

@ -2988,7 +2988,7 @@ if (QB.halted()) { return; }
await sub_AddGXMethod( "SUB" , "GXSleep" , True);
await sub_AddGXMethod( "FUNCTION" , "GXMouseX" , False);
await sub_AddGXMethod( "FUNCTION" , "GXMouseY" , False);
await sub_AddGXMethod( "FUNCTION" , "GXSoundLoad" , False);
await sub_AddGXMethod( "FUNCTION" , "GXSoundLoad" , True);
await sub_AddGXMethod( "SUB" , "GXSoundPlay" , False);
await sub_AddGXMethod( "SUB" , "GXSoundRepeat" , False);
await sub_AddGXMethod( "SUB" , "GXSoundVolume" , False);

View file

@ -183,17 +183,41 @@ a:after { content: " >"; }
}
#logo:hover { opacity: 1.0; }
#fs-contents {
display: grid;
grid-template-columns: auto 1.5em;
}
#fs-path {
margin: 5px;
padding: 5px;
border: 1px solid #333;
}
#fs-refresh {
#fs-refresh, #fs-new-folder {
float: right;
margin-top: -3px;
cursor: pointer;
height: 20px;
width: 20px;
background-size: 20px 20px;
background-repeat: no-repeat;
}
#fs-refresh {
margin-right: 5px;
background-image: url('img/refresh.svg');
}
#fs-refresh:hover {
background-image: url('img/refresh-hover.svg');
}
#fs-new-folder {
margin-right: 5px;
background-image: url('img/new-folder.svg');
}
#fs-new-folder:hover {
background-image: url('img/new-folder-hover.svg');
}
.fs-file, .fs-dir {
.fs-file, .fs-dir, .fs-delete {
display: block;
margin: 0px 5px;
padding: 5px;
@ -202,26 +226,36 @@ a:after { content: " >"; }
cursor: pointer;
}
.fs-file:hover, .fs-dir:hover {
background-color: rgb(255, 255, 255, .1);
}
.fs-delete:hover {
background-image: url('img/delete-hover.svg');
}
.fs-file {
background-image: url('file.png');
background-image: url('img/file.png');
background-repeat: no-repeat;
background-size: 20px 20px;
background-position: 1px 1px;
}
.fs-dir {
background-image: url('folder.png');
background-image: url('img/folder.png');
background-repeat: no-repeat;
background-size: 20px 20px;
background-position: 1px 2px;
}
#fs-refresh {
float: right;
.fs-delete {
background-image: url('img/delete.svg');
background-repeat: no-repeat;
background-size: 20px 20px;
/*background-position: center center;*/
padding: 0;
width: 100%;
margin: 0;
}
#toolbar {

View file

@ -677,6 +677,7 @@ function refreshFS() {
a.fullpath = currPath + "/..";
a.onclick = function() { chdir(this.fullpath); };
contents.appendChild(a);
contents.appendChild(document.createElement("span"));
}
var folders = vfs.getChildren(node, vfs.DIRECTORY);
@ -687,6 +688,11 @@ function refreshFS() {
a.fullpath = vfs.fullPath(folders[i]);
a.onclick = function() { chdir(this.fullpath); };
contents.appendChild(a);
a = document.createElement("a");
a.className = "fs-delete";
a.vfsnode = folders[i];
a.onclick = function() { deleteDir(this.vfsnode); };
contents.appendChild(a);
}
var files = vfs.getChildren(node, vfs.FILE);
@ -697,6 +703,39 @@ function refreshFS() {
a.fullpath = vfs.fullPath(files[i]);
a.onclick = function() { saveFile(this.fullpath); };
contents.appendChild(a);
a = document.createElement("a");
a.className = "fs-delete";
a.vfsnode = files[i];
a.onclick = function() { deleteFile(this.vfsnode); };
contents.appendChild(a);
}
function deleteFile(node) {
if (confirm("This will permanently delete file '" + node.name + "'.\nAre you sure you wish to continue?")) {
vfs.removeFile(node);
refreshFS();
}
}
function deleteDir(node) {
if (vfs.getChildren(node).length > 0) {
alert("Directory is not empty.");
return;
}
if (confirm("This will permanently delete directory '" + node.name + "'.\nAre you sure you wish to continue?")) {
vfs.removeDirectory(node);
refreshFS();
}
}
}
function onNewDirectory() {
var vfs = QB.vfs();
var parent = vfs.getNode(currPath);
var dirname = prompt("Enter new directory name");
if (dirname && dirname != "") {
vfs.createDirectory(dirname, parent);
refreshFS();
}
}

View file

@ -3189,7 +3189,7 @@ Sub InitGX
AddGXMethod "SUB", "GXSleep", True
AddGXMethod "FUNCTION", "GXMouseX", False
AddGXMethod "FUNCTION", "GXMouseY", False
AddGXMethod "FUNCTION", "GXSoundLoad", False
AddGXMethod "FUNCTION", "GXSoundLoad", True
AddGXMethod "SUB", "GXSoundPlay", False
AddGXMethod "SUB", "GXSoundRepeat", False
AddGXMethod "SUB", "GXSoundVolume", False

198
vfs.js
View file

@ -167,11 +167,25 @@ let VFS = function() {
};
this.getDataURL = async function(file) {
let blob = new Blob([file.data]);
let blob = null;
let type = getTypeFromName(file.name);
if (type) {
blob = new Blob([file.data], { type: type });
}
else {
blob = new Blob([file.data]);
}
let dataUrl = await new Promise(r => {let a=new FileReader(); a.onload=r; a.readAsDataURL(blob)}).then(e => e.target.result);
return dataUrl;
};
function getTypeFromName(filename) {
var parts = filename.split(".");
if (parts.length < 2) { return null; }
var ext = parts.pop();
return types[ext];
}
this.renameNode = function(node, newName) {
// TODO: move the file if the newName includes a path
var parent = node.parent;
@ -243,6 +257,186 @@ let VFS = function() {
tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
return tmp.buffer;
}
const types = {
// File Extension MIME Type
'abs': 'audio/x-mpeg',
'ai': 'application/postscript',
'aif': 'audio/x-aiff',
'aifc': 'audio/x-aiff',
'aiff': 'audio/x-aiff',
'aim': 'application/x-aim',
'art': 'image/x-jg',
'asf': 'video/x-ms-asf',
'asx': 'video/x-ms-asf',
'au': 'audio/basic',
'avi': 'video/x-msvideo',
'avx': 'video/x-rad-screenplay',
'bcpio': 'application/x-bcpio',
'bin': 'application/octet-stream',
'bmp': 'image/bmp',
'body': 'text/html',
'cdf': 'application/x-cdf',
'cer': 'application/pkix-cert',
'class': 'application/java',
'cpio': 'application/x-cpio',
'csh': 'application/x-csh',
'css': 'text/css',
'dib': 'image/bmp',
'doc': 'application/msword',
'dtd': 'application/xml-dtd',
'dv': 'video/x-dv',
'dvi': 'application/x-dvi',
'eot': 'application/vnd.ms-fontobject',
'eps': 'application/postscript',
'etx': 'text/x-setext',
'exe': 'application/octet-stream',
'gif': 'image/gif',
'gtar': 'application/x-gtar',
'gz': 'application/x-gzip',
'hdf': 'application/x-hdf',
'hqx': 'application/mac-binhex40',
'htc': 'text/x-component',
'htm': 'text/html',
'html': 'text/html',
'ief': 'image/ief',
'jad': 'text/vnd.sun.j2me.app-descriptor',
'jar': 'application/java-archive',
'java': 'text/x-java-source',
'jnlp': 'application/x-java-jnlp-file',
'jpe': 'image/jpeg',
'jpeg': 'image/jpeg',
'jpg': 'image/jpeg',
'js': 'application/javascript',
'jsf': 'text/plain',
'json': 'application/json',
'jspf': 'text/plain',
'kar': 'audio/midi',
'latex': 'application/x-latex',
'm3u': 'audio/x-mpegurl',
'mac': 'image/x-macpaint',
'man': 'text/troff',
'mathml': 'application/mathml+xml',
'me': 'text/troff',
'mid': 'audio/midi',
'midi': 'audio/midi',
'mif': 'application/x-mif',
'mov': 'video/quicktime',
'movie': 'video/x-sgi-movie',
'mp1': 'audio/mpeg',
'mp2': 'audio/mpeg',
'mp3': 'audio/mpeg',
'mp4': 'video/mp4',
'mpa': 'audio/mpeg',
'mpe': 'video/mpeg',
'mpeg': 'video/mpeg',
'mpega': 'audio/x-mpeg',
'mpg': 'video/mpeg',
'mpv2': 'video/mpeg2',
'ms': 'application/x-wais-source',
'nc': 'application/x-netcdf',
'oda': 'application/oda',
'odb': 'application/vnd.oasis.opendocument.database',
'odc': 'application/vnd.oasis.opendocument.chart',
'odf': 'application/vnd.oasis.opendocument.formula',
'odg': 'application/vnd.oasis.opendocument.graphics',
'odi': 'application/vnd.oasis.opendocument.image',
'odm': 'application/vnd.oasis.opendocument.text-master',
'odp': 'application/vnd.oasis.opendocument.presentation',
'ods': 'application/vnd.oasis.opendocument.spreadsheet',
'odt': 'application/vnd.oasis.opendocument.text',
'otg': 'application/vnd.oasis.opendocument.graphics-template',
'oth': 'application/vnd.oasis.opendocument.text-web',
'otp': 'application/vnd.oasis.opendocument.presentation-template',
'ots': 'application/vnd.oasis.opendocument.spreadsheet-template',
'ott': 'application/vnd.oasis.opendocument.text-template',
'ogx': 'application/ogg',
'ogv': 'video/ogg',
'oga': 'audio/ogg',
'ogg': 'audio/ogg',
'otf': 'application/x-font-opentype',
'spx': 'audio/ogg',
'flac': 'audio/flac',
'anx': 'application/annodex',
'axa': 'audio/annodex',
'axv': 'video/annodex',
'xspf': 'application/xspf+xml',
'pbm': 'image/x-portable-bitmap',
'pct': 'image/pict',
'pdf': 'application/pdf',
'pgm': 'image/x-portable-graymap',
'pic': 'image/pict',
'pict': 'image/pict',
'pls': 'audio/x-scpls',
'png': 'image/png',
'pnm': 'image/x-portable-anymap',
'pnt': 'image/x-macpaint',
'ppm': 'image/x-portable-pixmap',
'ppt': 'application/vnd.ms-powerpoint',
'pps': 'application/vnd.ms-powerpoint',
'ps': 'application/postscript',
'psd': 'image/vnd.adobe.photoshop',
'qt': 'video/quicktime',
'qti': 'image/x-quicktime',
'qtif': 'image/x-quicktime',
'ras': 'image/x-cmu-raster',
'rdf': 'application/rdf+xml',
'rgb': 'image/x-rgb',
'rm': 'application/vnd.rn-realmedia',
'roff': 'text/troff',
'rtf': 'application/rtf',
'rtx': 'text/richtext',
'sfnt': 'application/font-sfnt',
'sh': 'application/x-sh',
'shar': 'application/x-shar',
'sit': 'application/x-stuffit',
'snd': 'audio/basic',
'src': 'application/x-wais-source',
'sv4cpio': 'application/x-sv4cpio',
'sv4crc': 'application/x-sv4crc',
'svg': 'image/svg+xml',
'svgz': 'image/svg+xml',
'swf': 'application/x-shockwave-flash',
't': 'text/troff',
'tar': 'application/x-tar',
'tcl': 'application/x-tcl',
'tex': 'application/x-tex',
'texi': 'application/x-texinfo',
'texinfo': 'application/x-texinfo',
'tif': 'image/tiff',
'tiff': 'image/tiff',
'tr': 'text/troff',
'tsv': 'text/tab-separated-values',
'ttf': 'application/x-font-ttf',
'txt': 'text/plain',
'ulw': 'audio/basic',
'ustar': 'application/x-ustar',
'vxml': 'application/voicexml+xml',
'xbm': 'image/x-xbitmap',
'xht': 'application/xhtml+xml',
'xhtml': 'application/xhtml+xml',
'xls': 'application/vnd.ms-excel',
'xml': 'application/xml',
'xpm': 'image/x-xpixmap',
'xsl': 'application/xml',
'xslt': 'application/xslt+xml',
'xul': 'application/vnd.mozilla.xul+xml',
'xwd': 'image/x-xwindowdump',
'vsd': 'application/vnd.visio',
'wav': 'audio/x-wav',
'wbmp': 'image/vnd.wap.wbmp',
'wml': 'text/vnd.wap.wml',
'wmlc': 'application/vnd.wap.wmlc',
'wmls': 'text/vnd.wap.wmlsc',
'wmlscriptc': 'application/vnd.wap.wmlscriptc',
'wmv': 'video/x-ms-wmv',
'woff': 'application/font-woff',
'woff2': 'application/font-woff2',
'wrl': 'model/vrml',
'wspolicy': 'application/wspolicy+xml',
'z': 'application/x-compress',
'zip': 'application/zip'
};
}
@ -257,3 +451,5 @@ if (!ArrayBuffer.prototype.slice) {
return result;
}
}