2.0.2 • Published 5 years ago

webfind v2.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

WebFind

Find files in browser with help of serverside.

Install

npm i webfind -g

Use as standalone

Start webfind, go to url http://localhost:1337

API

Client API

webfind(element , prefix, callback)

  • element - html element, or selector
  • prefix - (optional) prefix to url (same as in server)
  • callback - function to call after init

When prefix set in server and client, you should use same prefix in html. For example, if you use prefix /webfind you should connect webfind script in this way:

<script src="/webfind/webfind.js"></script>

Server API

webfind(options);

Could be used as middleware, or for init WebFind.

webfind({
    server: server,/* only one should be passed: */
    socket: socket,/* server or socket  */
    online: true, /* default */
    minify: true, /* default */
    prefix:'/webfind' /* default */
})

webfind.middle(options);

Middleware function if there is a need of init socket in another place.

webfind.middle({
    prefix: '/webfind', /* default */
    online: true, /* default */
    minify: true, /* default */
})

Use as middleware

To use WebFind in your programs you should make local install:

npm i webfind express --save

And use it in your program

/* server.js */

var webfind     = require('webfind'),
    http        = require('http'),
    express     = require('express'),
    
    app         = express(),
    server      = http.createServer(app),
    
    port        = 1337,
    ip          = '0.0.0.0';
    
app .use(webfind({
        server: server,
        online: true /* load jquery and socket.io from cdn */
    }))
    .use(express.static(__dirname));

server.listen(port, ip);
<!-- index.html -->

<div class="webfind"></div>
<script src="/webfind/webfind.js"></script>
<script>
    (function() {
        'use strict';
        
        window.addEventListener('load', load);
        
        function load() {
            window.removeEventListener('load', load);
            
            webfind('.webfind', function() {
                console.log('webfind ready')
            });
        }
    })()
</script>

License

MIT

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

7 years ago

1.0.1

7 years ago

1.0.0

8 years ago

0.5.8

8 years ago

0.5.7

9 years ago

0.5.6

9 years ago

0.5.5

9 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.5

10 years ago

0.4.4

10 years ago

0.4.3

10 years ago

0.4.2

11 years ago

0.4.1

11 years ago

0.4.0

11 years ago

0.3.0

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago