Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-webhdfs

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-webhdfs - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

19

package.json
{
"name": "node-webhdfs",
"version": "0.2.0",
"version": "0.2.1",
"description": "A WebHDFS module for Node.js.",

@@ -8,16 +8,7 @@ "author": "Ryan Cole <ryan@rycole.com> (http://rycole.com)",

"main": "src/webhdfs.js",
"keywords": [
"hdfs",
"webhdfs",
"http"
],
"keywords": ["hdfs", "webhdfs", "http"],
"bugs": {
"url": "mailto:ryan@rycole.com"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"license": "MIT",
"dependencies": {

@@ -28,4 +19,4 @@ "request": "^2.45.0",

"devDependencies": {
"mocha": "^1.21.4",
"should": "^4.0.4"
"mocha": "^1.21.5",
"should": "^4.6.5"
},

@@ -32,0 +23,0 @@ "repository": {

@@ -9,2 +9,2 @@ A WebHDFS module for Node.js

I use [Mocha](http://visionmedia.github.com/mocha/) and [should.js](https://github.com/visionmedia/should.js) for unit testing. They will be required if you want to run the unit tests. To execute the tests, simply `npm test`, but install the requirements first.
I use [Mocha](https://mochajs.org/) and [should.js](https://github.com/visionmedia/should.js) for unit testing. They will be required if you want to run the unit tests. To execute the tests, simply `npm test`, but install the requirements first. You will also likely need to adjust the constants in the test file first (or have a username "ryan" setup for hosts "endpoint1" and "endpoint2").

@@ -408,8 +408,14 @@ var querystring = require('querystring'),

request.post(args, function (error, response, body) {
parseResponse(error, response, body);
// check for expected redirect
if (response.statusCode == 307) {
if (error) {
// callback already called
return;
}
// check for HDFS server unreachable
else if (! response) {
return callback(new Error('no response'));
}
// check for expected redirect
else if (response.statusCode == 307) {
// format request args

@@ -426,8 +432,10 @@ args = _.defaults({

parseResponse(error, response, body);
if (error) {
return;
}
// check for expected response
if (response.statusCode == 200) {
if (response && response.statusCode == 200) {
return callback(null, true);
} else {
return callback(new Error('expected http 200: ' + response.body));
return callback(new Error('expected http 200: ' + response ? response.body : response));
}

@@ -481,5 +489,12 @@ });

parseResponse(error, response, body);
if (error) {
// callback already called
return;
}
// check for HDFS server unreachable
else if (! response) {
return callback(new Error('expected response for HDFS'));
}
// check for expected redirect
if (response.statusCode == 307) {
else if (response.statusCode == 307) {

@@ -497,5 +512,7 @@ // generate query string

parseResponse(error, response, body);
if (error) {
return;
}
// check for expected created response
if (response.statusCode == 201) {
if (response && response.statusCode == 201) {
// execute callback

@@ -502,0 +519,0 @@ return callback(null, response.headers.location);

@@ -0,1 +1,4 @@

const username = 'ryan';
const endpoint1 = 'endpoint1';
const endpoint2 = 'endpoint2';

@@ -6,18 +9,12 @@ var should = require('should');

describe('WebHDFSClient', function () {
var client = new (require('..')).WebHDFSClient({ user: username });
var client = new (require('..')).WebHDFSClient({
"user": "hdfs",
"namenode_port": 50070,
"path_prefix": "/webhdfs/v1",
namenode_host: "c1b5s2.tera4.terascope.io",
"namenode_list": ["c1b5s2.tera4.terascope.io", "c1b5s1.tera4.terascope.io"]
});
var client2 = new (require('..')).WebHDFSClient({
namenode_host: "endpoint1"
namenode_host: endpoint1
});
var client3 = new (require('..')).WebHDFSClient({
namenode_host: "endpoint1",
namenode_list: ["endpoint1", "endpoint2"]
namenode_host: endpoint1,
namenode_list: [endpoint1, endpoint2]
});

@@ -28,3 +25,3 @@

it('should set high_availability to false if a list is not provided', function (done) {
client2.should.have.property('base_url', 'http://endpoint1:50070/webhdfs/v1');
client2.should.have.property('base_url', 'http://' + endpoint1 + ':50070/webhdfs/v1');
client2.options.should.have.property('high_availability', false);

@@ -36,7 +33,7 @@

it('should change endpoint if a list is provided', function (done) {
client3.should.have.property('base_url', 'http://endpoint1:50070/webhdfs/v1');
client3.should.have.property('base_url', 'http://' + endpoint1 + ':50070/webhdfs/v1');
client3.options.should.have.property('high_availability', true);
client3._changeNameNodeHost();
client3.should.have.property('base_url', 'http://endpoint2:50070/webhdfs/v1');
client3.should.have.property('base_url', 'http://' + endpoint2 + ':50070/webhdfs/v1');

@@ -199,2 +196,2 @@ return done()

});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc