简体   繁体   English

如何从node.js删除hdfs文件

[英]How to delete a hdfs file from node.js

I have the following file in hdfs 我在hdfs中有以下文件

hdfs://localhost.localdomain:8020/user/cloudera/direccionbikes.out

I wrote a process in node.js and I need to delete this file. 我在node.js中编写了一个进程,我需要删除该文件。 I use the api webhdfs. 我使用api webhdfs。

I use createReadStream and createWriteStream in this program. 我在此程序中使用createReadStream和createWriteStream。 But I don't know how to delete this file from node.js 但我不知道如何从node.js删除此文件

Where can I read information about this question(webhdfs) 我在哪里可以阅读有关此问题的信息(webhdfs)

You can read about the APIs here - https://hadoop.apache.org/docs/r1.0.4/webhdfs.html 您可以在此处阅读有关API的信息-https: //hadoop.apache.org/docs/r1.0.4/webhdfs.html

Submit a HTTP DELETE request . 提交HTTP DELETE请求

curl -i -X DELETE "http://<host>:<port>/webhdfs/v1/<path>?op=DELETE
                              [&recursive=<true|false>]"

The client receives a response with a boolean JSON object: 客户端收到带有布尔JSON对象的响应:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

{"boolean": true}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM