https://github.com/cloudcmd/webfind
Web find files
https://github.com/cloudcmd/webfind
cloudcmd find javascript nodejs
Last synced: 3 months ago
JSON representation
Web find files
- Host: GitHub
- URL: https://github.com/cloudcmd/webfind
- Owner: cloudcmd
- License: mit
- Created: 2014-09-23T06:53:27.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-04-16T11:38:59.000Z (almost 6 years ago)
- Last Synced: 2025-03-18T05:36:30.769Z (11 months ago)
- Topics: cloudcmd, find, javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 229 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
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:
``
### Server API
**webfind(options);**
Could be used as middleware, or for init `WebFind`.
```js
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.
```js
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
```js
/* 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);
```
```html
(function() {
'use strict';
window.addEventListener('load', load);
function load() {
window.removeEventListener('load', load);
webfind('.webfind', function() {
console.log('webfind ready')
});
}
})()
```
## License
MIT