You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2019/07/04 11:36:13 UTC

[couchdb-nano] 01/01: get attachment should return a Buffer

This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch issue]170
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git

commit 6f64246dff035d9eeb80c39b6bd938639f8524ff
Author: Glynn Bird <gl...@gmail.com>
AuthorDate: Thu Jul 4 12:35:36 2019 +0100

    get attachment should return a Buffer
---
 .npmignore    | 3 +++
 lib/nano.d.ts | 6 +++---
 lib/nano.js   | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/.npmignore b/.npmignore
index 75d43a3..69ef77e 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,2 +1,5 @@
 tests
 scripts
+examples
+coverage
+.github
diff --git a/lib/nano.d.ts b/lib/nano.d.ts
index 31b60d3..3de6a57 100644
--- a/lib/nano.d.ts
+++ b/lib/nano.d.ts
@@ -350,14 +350,14 @@ declare namespace nano {
       contenttype: string,
       params: any
     ): Request
-    get(docname: string, attname: string, callback?: Callback<any>): Promise<any>;
+    get(docname: string, attname: string, callback?: Callback<Buffer>): Promise<Buffer>;
     getAsStream(docname: string, attname: string): Request;
     get(
       docname: string,
       attname: string,
       params: any,
-      callback?: Callback<any>
-    ): Promise<any>;
+      callback?: Callback<Buffer>
+    ): Promise<Buffer>;
     destroy(docname: string, attname: string, callback?: Callback<any>): Promise<any>;
     destroy(
       docname: string,
diff --git a/lib/nano.js b/lib/nano.js
index 8522a30..d73e634 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -226,7 +226,7 @@ module.exports = exports = function dbScope (cfg) {
     }
 
     // prevent bugs where people set encoding when piping
-    if (opts.encoding !== undefined && callback) {
+    if (opts.encoding !== undefined) {
       req.encoding = opts.encoding
       delete req.headers['content-type']
       delete req.headers.accept