Skip to content

Commit a5f4266

Browse files
authored
Merge pull request #2 from btrepp/feat/bloburl
Adds blob to url functions
2 parents b98b742 + a630297 commit a5f4266

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/Web/File/URL.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use strict";
2+
3+
exports.createObjectURL = function (blob) {
4+
return function () {
5+
return URL.createObjectURL(blob);
6+
};
7+
};
8+
9+
exports.revokeObjectURL = function (url) {
10+
return function () {
11+
URL.revokeObjectURL(url);
12+
};
13+
};

src/Web/File/URL.purs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module Web.File.Url
2+
(createObjectURL
3+
, revokeObjectURL
4+
) where
5+
6+
import Prelude
7+
import Effect (Effect)
8+
import Web.File.Blob (Blob)
9+
10+
11+
-- | Adds this blob to the url store
12+
-- | The string is a url that can be used to
13+
-- | 'download' the blob
14+
foreign import createObjectURL :: Blob -> Effect String
15+
16+
-- | Revoke a blob url from the url store
17+
-- | Doesn't throw errors on failure
18+
foreign import revokeObjectURL :: String -> Effect Unit

0 commit comments

Comments
 (0)