Comparing version 1.0.2 to 1.0.3
43
index.js
@@ -47,3 +47,5 @@ 'use strict' | ||
else if (res.statusCode == 404) { | ||
Database.createDB(this.config, this.db, (err)=>{ | ||
Database.createDB(this.getConfig({ | ||
db: this.db | ||
}), (err)=>{ | ||
if (err) cb(err) | ||
@@ -158,8 +160,5 @@ else { | ||
if (!cb) cb = ()=>{} | ||
let uri = url.format({ | ||
protocol : this.config.protocol, | ||
hostname : this.config.hostname, | ||
port : this.config.port, | ||
let uri = url.format(this.getConfig({ | ||
pathname : '/'+encodeURIComponent(this.db)+'/'+encodeURIComponent(id) | ||
}) | ||
})) | ||
const str = new stream.Readable() | ||
@@ -180,8 +179,5 @@ str.push(JSON.stringify(doc)) | ||
if (!cb) cb = ()=>{} | ||
let uri = url.format({ | ||
protocol: this.config.protocol, | ||
hostname : this.config.hostname, | ||
port : this.config.port, | ||
let uri = url.format(this.getConfig({ | ||
pathname : '/'+encodeURIComponent(this.db)+'/'+encodeURIComponent(id) | ||
}) | ||
})) | ||
request(uri, (err, res, body)=>{ | ||
@@ -199,3 +195,5 @@ if (err) cb(err) | ||
if (!cb) cb = ()=>{} | ||
let uri = url.format(this.getConfig({pathname: '/'+encodeURIComponent(this.db)+'/_all_docs'})) | ||
let uri = url.format(this.getConfig({ | ||
pathname: '/'+encodeURIComponent(this.db)+'/_all_docs' | ||
})) | ||
request(uri, (err, res, body)=>{ | ||
@@ -219,8 +217,5 @@ if (err) cb(err) | ||
} | ||
let uri = url.format({ | ||
protocol: this.config.protocol, | ||
hostname: this.config.hostname, | ||
port: this.config.port, | ||
let uri = url.format(this.getConfig({ | ||
pathname: '/'+encodeURIComponent(this.db)+'/'+encodeURIComponent(id) | ||
}) | ||
})) | ||
let str = new stream.Readable() | ||
@@ -246,6 +241,3 @@ str.push(JSON.stringify(data)) | ||
else { | ||
let uri = url.format({ | ||
protocol: this.config.protocol, | ||
hostname: this.config.hostname, | ||
port: this.config.port, | ||
let uri = url.format(this.getConfig({ | ||
pathname: '/'+encodeURIComponent(this.db)+'/'+encodeURIComponent(id), | ||
@@ -255,3 +247,3 @@ query: { | ||
} | ||
}) | ||
})) | ||
request.delete(uri, (err, res, body)=>{ | ||
@@ -272,6 +264,3 @@ if (err) cb(err) | ||
let fstream = fs.createReadStream(file.path) | ||
let uri = url.format({ | ||
protocol: this.config.protocol, | ||
hostname: this.config.hostname, | ||
port: this.config.port, | ||
let uri = url.format(this.getConfig({ | ||
pathname: '/'+encodeURIComponent(this.db)+'/'+encodeURIComponent(id)+'/'+file.name, | ||
@@ -281,3 +270,3 @@ query: { | ||
} | ||
}) | ||
})) | ||
fstream.pipe(request.put({ | ||
@@ -284,0 +273,0 @@ url: uri, |
{ | ||
"name": "couchdbjs", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A node client for couchdb.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,2 +7,8 @@ # couchdbjs | ||
![npm](https://img.shields.io/npm/v/couchdbjs.svg?style=flat-square) | ||
![npm](https://img.shields.io/npm/dm/couchdbjs.svg?style=flat-square) | ||
![npm](https://img.shields.io/npm/dt/couchdbjs.svg?style=flat-square) | ||
![npm](https://img.shields.io/npm/l/couchdbjs.svg?style=flat-square) | ||
![Dependencies](https://david-dm.org/prateekkumarweb/couchdbjs.svg?style=flat-square) | ||
### Install | ||
@@ -9,0 +15,0 @@ ```shell |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214
14303
266