git ssb

0+

Dominic / polyraf



Commit a5bd64597b0d3de434c72eec2df82b00f04d1d33

initial

Dominic Tarr committed on 3/24/2019, 9:34:49 AM

Files changed

LICENSEadded
README.mdadded
browser.jsadded
index.jsadded
package.jsonadded
LICENSEView
@@ -1,0 +1,22 @@
1 +Copyright (c) 2019 Dominic Tarr
2 +
3 +Permission is hereby granted, free of charge,
4 +to any person obtaining a copy of this software and
5 +associated documentation files (the "Software"), to
6 +deal in the Software without restriction, including
7 +without limitation the rights to use, copy, modify,
8 +merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom
10 +the Software is furnished to do so,
11 +subject to the following conditions:
12 +
13 +The above copyright notice and this permission notice
14 +shall be included in all copies or substantial portions of the Software.
15 +
16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
20 +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
README.mdView
@@ -1,0 +1,21 @@
1 +# polyraf
2 +
3 +like rafify, but uses either [random-access-file](https://github.com/random-access-storage/random-access-file/) if running in node (or electron)
4 +and [random-access-web](https://github.com/random-access-storage/random-access-web) (if running in a browser or similar)
5 +
6 +``` js
7 +var PolyRAF = require('polyraf')
8 +var raf = PolyRAF(filename) //and if passed a raf instance
9 +
10 +var _raf = PolyRAF(raf) //if called with a raf instance, returns it.
11 +//_raf == raf
12 +
13 +//also, keeps the filename as a property (non-standard)
14 +console.log(raf.filename)
15 +```
16 +
17 +## License
18 +
19 +MIT
20 +
21 +
browser.jsView
@@ -1,0 +1,13 @@
1 +const RAF = require('random-access-web')
2 +
3 +module.exports = function (filename) {
4 + if('string' === typeof filename) {
5 + const raf = RAF(filename)
6 + raf.filename = filename
7 + return raf
8 + }
9 + return filename
10 +}
11 +
12 +
13 +
index.jsView
@@ -1,0 +1,13 @@
1 +const RAF = require('random-access-file')
2 +
3 +module.exports = function (filename) {
4 + if('string' === typeof filename) {
5 + const raf = RAF(filename)
6 + raf.filename = filename
7 + return raf
8 + }
9 + return filename
10 +}
11 +
12 +
13 +
package.jsonView
@@ -1,0 +1,23 @@
1 +{
2 + "name": "polyraf",
3 + "description": "",
4 + "version": "1.0.0",
5 + "homepage": "https://github.com/dominictarr/polyraf",
6 + "repository": {
7 + "type": "git",
8 + "url": "git://github.com/dominictarr/polyraf.git"
9 + },
10 + "dependencies": {
11 + "random-access-file": "^2.1.0",
12 + "random-access-web": "^2.0.1"
13 + },
14 + "browser": {
15 + "./index.js": "./browser.js"
16 + },
17 + "devDependencies": {},
18 + "scripts": {
19 + "test": "tape test/*.js"
20 + },
21 + "author": "Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)",
22 + "license": "MIT"
23 +}

Built with git-ssb-web