Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
uzoice committed Sep 3, 2014
1 parent ea7d426 commit dfae95a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ app.listen(3000);
checkBody,checkQuery,checkParams will return a Validator instance.
when use `app.use(require('koa-validate')())` ,the request context will bind the method:

- **checkBody(filedName)** - check POST body.
- **checkQuery(filedName)** - check GET query.
- **checkParams(filedName)** - check the params in the urls.
- **checkFile(filedName,[deleteOnCheckFailed])** - check the file object, if you use [koa-body](https://github.com/dlau/koa-body).this function will return `FileValidator` object. `deleteOnCheckFailed` default value is `true`
- **checkBody(fieldName)** - check POST body.
- **checkQuery(fieldName)** - check GET query.
- **checkParams(fieldName)** - check the params in the urls.
- **checkFile(fieldName,[deleteOnCheckFailed])** - check the file object, if you use [koa-body](https://github.com/dlau/koa-body).this function will return `FileValidator` object. `deleteOnCheckFailed` default value is `true`


## Validator Api
Expand Down Expand Up @@ -156,8 +156,9 @@ when use `app.use(require('koa-validate')())` ,the request context will bind the
- **md5()** - md5 current value into hex string.
- **sha1()** - sha1 current value into hex string.

### checkFile
Validators:
### FileValidator:

#### Validators:

- **empty()** - current file field can to be a empty file.
- **notEmpty([tip])** - current file field can not to be a empty file.
Expand All @@ -167,7 +168,7 @@ Validators:
- **fileNameMatch(reg,[tip])** - check the file's name with regular expression.
- **suffixIn(arr,[tip])** - check the suffix of file's if in specified arr. `arr` eg. ['png','jpg']

Sanitizers:
#### Sanitizers:

- **move(target)** - move upload file to the target location. target can be a string or function or function*. target function interface:function (fileObject,fieldName,context) .
- **copy(target)** - move upload file to the target location. target can be a string or function or function*. target function interface:function (fileObject,fieldName,context) .
Expand Down

0 comments on commit dfae95a

Please sign in to comment.