Node js Blueprints Tsonev 2024 scribd download
Node js Blueprints Tsonev 2024 scribd download
com
https://ebookname.com/product/node-js-blueprints-tsonev/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookname.com/product/node-js-by-example-1st-edition-tsonev/
ebookname.com
https://ebookname.com/product/node-js-in-practice-1st-edition-alex-r-
young/
ebookname.com
https://ebookname.com/product/ext-js-application-development-
blueprints-1st-edition-ramsay/
ebookname.com
https://ebookname.com/product/measuring-society-1st-edition-chaitra-h-
nagaraja/
ebookname.com
https://ebookname.com/product/food-lipids-chemistry-nutrition-and-
biotechnology-third-edition-food-science-technology-casimir-c-akoh/
ebookname.com
https://ebookname.com/product/psychoanalysis-of-aging-and-
maturity-1st-edition-guillermo-julio-montero/
ebookname.com
https://ebookname.com/product/the-language-of-conversation-linguistic-
theory-guides-1st-edition-f-pridham/
ebookname.com
The Racing High performance Tire 1st Edition Paul Haney
https://ebookname.com/product/the-racing-high-performance-tire-1st-
edition-paul-haney/
ebookname.com
Node.js Blueprints
Krasimir Tsonev
BIRMINGHAM - MUMBAI
Node.js Blueprints
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78328-733-8
www.packtpub.com
Bojan currently lives in Germany and works for GMG GmbH & Co. KG, developing
a wide range of cross-platform color management and printing solutions, using both
Microsoft and open-source technologies. In his spare time, he actively participates in
open source projects.
He also has worked on the book Professional Visual Studio 2008, Wrox.
To Carina, my wife.
Leo Hsieh graduated from USF with a Master's degree in Web Science in 2011.
He has been working as a software engineer for over two and a half years. He is
an open-source JavaScript developer, interested in frontend development and
Node.js. Although he is more focused on frontend development, he is able to
work on backend development with Java and Python as well.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM
http://PacktLib.PacktPub.com
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print and bookmark content
• On demand and accessible via web browser
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
[ vi ]
Preface
As you probably know, the big things in our sphere are those that are moved by the
community. Node.js is a technology that has become really popular. Its ecosystem
is well-designed and brings with it the flexibility we need. With the rise of mobile
development, JavaScript occupies a big part of the technology stack nowadays.
The ability to use JavaScript on the server side is really interesting. It's good to know
how Node.js works and where and when to use it, but it is more important to see
some examples. This book will show you how this wonderful technology handles
real use cases.
Chapter 2, Developing a Basic Site with Node.js and Express, discusses how ExpressJS
is one of the top frameworks on the market. ExpressJS was included because of its
fundamental importance in the Node.js world. At the end of the chapter, you will
be able to create applications using the built-in Express modules and also add your
own modules.
Chapter 3, Writing a Blog Application with Node.js and AngularJS, teaches you how to
use frontend frameworks such as AngularJS with Node.js. The chapter's example is
actually a dynamic application that works with real databases.
Chapter 4, Developing a Chat with Socket.IO, explains that nowadays, every big web
app uses real-time data. It's important to show instant results to the users. This
chapter covers the creation of a simple real-time chat. The same concept can be used
to create an automatically updatable HTML component.
Preface
Chapter 5, Creating a To-do Application with Backbone.js, illustrates that Backbone.js was
one of the first frameworks that introduced data binding at the frontend of applications.
This chapter will show you how the library works. The to-do app is a simple example,
but perfectly illustrates how powerful the framework is.
Chapter 6, Using Node.js as a Command-line Tool, covers the creation of a simple CLI
program. There are a bunch of command-line tools written in Node.js, and the
ability to create your own tool is quite satisfying. This part of the book will present
a simple application which grabs all the images in a directory and uploads them
to Flickr.
Chapter 7, Showing a Social Feed with Ember.js, describes an Ember.js example that will
read a Twitter feed and display the latest posts. That's actually a common task of
every developer because a lot of applications need to visualize social activity.
Chapter 8, Developing Web App Workflow with Grunt and Gulp, shows that there are
a bunch of things to do before you can deliver the application to the users, such as
concatenation, minification, templating, and so on. Grunt is the de facto standard
for such tasks. The described module optimizes and speeds up your workflow. The
chapter presents a simple application setup, including managing JavaScript, CSS,
HTML, and cache manifests.
Chapter 9, Automate Your Testing with Node.js, signifies that tests are really important
for every application nowadays. Node.js has some really great modules for this. If
you are a fan of test-driven development, this chapter is for you.
Chapter 10, Writing Flexible and Modular CSS, introduces the fact that two of the
most popular CSS preprocessors are written in Node.js. This chapter is like a little
presentation on them and, of course, describes styling a simple web page.
Chapter 11, Writing a REST API, states that Node.js is a fast-working technology, and
it is the perfect candidate for building a REST API. You will learn how to create a
simple API to store and retrieve data for books, that is, an online library.
Chapter 12, Developing Desktop Apps with Node.js, shows that Node.js is not just a web
technology—you can also create desktop apps with it. It's really interesting to know
that you can use HTML, CSS, and JavaScript to create desktop programs. Creating a
simple file browser may not be such a challenging task, but it will give you enough
knowledge to build your own applications.
[2]
Preface
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"The http module, which we initialize on the first line, is needed for running the
web server."
New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in the text like this: "Click on
the blue button with the text OK, I'LL AUTHORIZE IT."
[3]
Preface
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
[4]
Preface
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you would report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the errata submission form link,
and entering the details of your errata. Once your errata are verified, your submission
will be accepted and the errata will be uploaded on our website, or added to any list of
existing errata, under the Errata section of that title. Any existing errata can be viewed
by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you
come across any illegal copies of our works, in any form, on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
[5]
Common Programming
Paradigms
Node.js is a JavaScript-driven technology. The language has been in development for
more than 15 years, and it was first used in Netscape. Over the years, they've found
interesting and useful design patterns, which will be of use to us in this book. All this
knowledge is now available to Node.js coders. Of course, there are some differences
because we are running the code in different environments, but we are still able
to apply all these good practices, techniques, and paradigms. I always say that it
is important to have a good basis to your applications. No matter how big your
application is, it should rely on flexible and well-tested code. The chapter contains
proven solutions that guarantee you a good starting point. Knowing design patterns
doesn't make you a better developer because in some cases, applying the principles
strictly won't work. What you actually get is ideas, which will help you in thinking
out of the box. Sometimes, programming is all about managing complexity. We all
meet problems, and the key to a well-written application is to find the best suitable
solutions. The more paradigms we know, the easier our work is because we have
proven concepts that are ready to be applied. That's why this book starts with an
introduction to the most common programming paradigms.
Common Programming Paradigms
Node.js fundamentals
Node.js is a single-threaded technology. This means that every request is processed
in only one thread. In other languages, for example, Java, the web server instantiates
a new thread for every request. However, Node.js is meant to use asynchronous
processing, and there is a theory that doing this in a single thread could bring good
performance. The problem of the single-threaded applications is the blocking I/O
operations; for example, when we need to read a file from the hard disk to respond to
the client. Once a new request lands on our server, we open the file and start reading
from it. The problem occurs when another request is generated, and the application is
still processing the first one. Let's elucidate the issue with the following example:
var http = require('http');
var getTime = function() {
var d = new Date();
return d.getHours() + ':' + d.getMinutes() + ':' +
d.getSeconds() + ':' + d.getMilliseconds();
}
var respond = function(res, str) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(str + '\n');
console.log(str + ' ' + getTime());
}
var handleRequest = function (req, res) {
console.log('new request: ' + req.url + ' - ' + getTime());
if(req.url == '/immediately') {
respond(res, 'A');
} else {
var now = new Date().getTime();
while(new Date().getTime() < now + 5000) {
// synchronous reading of the file
}
respond(res, 'B');
}
}
http.createServer(handleRequest).listen(9000, '127.0.0.1');
[8]
Random documents with unrelated
content Scribd suggests to you:
should he escape and raise another army, with the hot weather and
the inundations coming on, he may bother us for another year. So
hie after him! Let us hope the gentleman will have the politeness to
wait for us at Khanpur, and not lead us away into the desert on an
unmannerly wild-goose hunt for Umarganj.”
“Hard luck for you to lose him, General, when you so nearly had
your fingers on him again!”
“Precious hard luck! But no, I won’t have a word said against
my luck—my most astounding good luck! That Rickmer’s column
should get in safe, despite its commander’s utmost efforts, that both
my reinforcements, from up and down the river, should arrive in the
very nick of time, that we should run across that herdsman this
morning, and learn that while we were flourishing forth to fight
empty air the enemy was in full march for our communications—
what d’ye call that? Nay, I will go further, and instead of what in our
pagan style we call luck, say that the hand of Providence has been
manifest throughout. There is a great future before Khemistan—I’m
convinced of it. I see all the hoarded wealth of Central Asia pouring
down the river, and making Bab-us-Sahel a port richer and more
extensive by far than Bombay. (As soon as I have time to think of
anything but fighting, my first care shall be the provision of a proper
harbour.) I see the great city of Victoria rising on the upper river,
occupying the whole of the site now covered by the wretched hovels
of Sahar and Bahar and the mouldering ramparts of Bori—the scene
of an annual fair beside which the glories of Novgorod grow pale,
where the silks of Gamara and the embroideries of China are spread
forth to entrance the eyes of the simple Arabit bringing for sale the
precious gums of his mountain deserts and the wiry beasts of his
own breeding. I see that Arabit—son and brother of the grim fighters
whose piled corpses I passed with unavailing horror and regret on
my way hither,—his immemorial weapons laid aside at the behest of
British power, not merely cultivating a desire for the manufactures of
the West, and thereby benefiting my beloved native land, but
perceiving for the first time the blessings of peace and the
advantages of commerce, and carrying the tale to the dwellers in his
rugged glens. Positively there’s no end to the wonders that will
follow naturally upon this day’s conquest. The price is heavy—those
gory heaps, not merely of the enemy, but of our own best and
bravest,—but Heaven is my witness that had the choice lain with
me, not one drop of blood had been shed. My hands are clean, for
all that I have been ‘a man of war from my youth.’”
“Who could deny it, General? Certainly no one that knows you,
or has taken part in the campaign. The enemy themselves will be
the first to admit it, when they are learning under your guidance the
lessons of peace as they have done—not by their own good will, I’ll
confess—those of war.”
Undoubtedly Brian possessed to perfection the art of smoothing
down the lion. Sir Harry’s rugged countenance radiated pleasure and
contentment, though he felt bound to protest.
“Well, well, we mustn’t make too sure! Yet it seems as though
Heaven had designs for me as well as for Khemistan. To be riding
gently up and down for three mortal hours at Mahighar between
opposing forces never more than fifteen yards apart, the target of
both—for when the —th got excited and fired high their bullets came
rattling about my head—and yet to go unscathed! To lead my
soldiers unwittingly into the line of fire to-day, then down into that
nullah, with matchlocks directed at my heart in dozens from the
farther bank, and those fiery swordsmen dashing upon me whirling
their deadly blades! Delany, I found my sword-hilt smashed by a
bullet; after I had sent you away one of the enemy’s magazines blew
up close to me; yet I was unhurt. Not even Black Prince was
touched, poor beast!—which at Mahighar was neither more nor less
than a miracle—though my orderly behind me was unhorsed both
then and to-day. Nor have I been compelled to defend my own life
at the cost of another’s. To-day an Arabit ran at me with his sword
uplifted. I had a pistol ready, and could have shot him, but a soldier
stopped him with his bayonet before he could reach me. Even my
staff seem to share my immunity. Though riding hither and thither
on errands in the thickest of the fray, not one of you has even been
hit until you took this hurt of yours, and you came by that through
your thirst for hand-to-hand fighting, against which I have warned
you. There is indeed something remarkable in all this. D’ye know the
people have found a new name for me? Several times as I rode here
I saw groups of ’em bowing profoundly at the roadside, and on my
orderly calling out that the Bahadar Jang was in a hurry and could
hear no petitions now, their sole reply was to prostrate themselves
reverently, ejaculating ‘Padishah!’”
“And why not, sir?” asked Brian heartily—he had been fearing
the General had heard himself mentioned by the less complimentary
title of “Brother of Satan.” “Who would be so fit as yourself to
administer the territory you have added to Her Majesty’s
dominions?”
“Well, that ain’t for me to say——” Sir Harry was obviously not
ill-pleased. “The Governor-General will select whom he chooses—
though I don’t pretend to be ignorant of his appreciation of the
efforts of the army. That dâk which came in before we marched this
morning was Lord Maryport’s, containing his congratulations to us on
Mahighar. I have had no time to read it through, but it contained
some awards—Keeling is promoted aide-de-camp to the G.-G., I
remember—and he promises further promotions when he has been
able to study my despatches more fully. To be elated by the praises
of a civilian—pshaw! am I as weak as that? I trust not, I believe not.
Praise from the Duke, now—the assurance that the humblest of his
Grace’s pupils, endeavouring to put in practice lessons learnt from
that great man, had made no heinous mistake,—that would gratify
my most greedy desires, and lacking that, I shall remain unsatisfied.
Put it that Lord Maryport appoints me Governor of Khemistan, as
you suggest. I am touched by such a proof of his lordship’s
confidence, and naturally strive to acquit myself to his satisfaction,
but if he desired to do me a personal favour, he could please me no
better than by sending me back to my wife and girls. What are
Khemistan and the winning of battles to me compared with them?”
“But sure you’ll have both, General. Lady Lennox and the young
ladies won’t consent to be kept at Poonah much longer with you up
here, if I know ’em.”
“Possibly it may be feasible to get them here after the hot
weather. Then indeed I should have nothing left to wish for. But I
must be moving. I am glad to leave you here to look after your
sister. See to it that she never rides alone, by the bye. Munshi was
telling me some foolish tale of Kamal-ud-din’s believing that our luck
resides in her presence with us, and no doubt he is capable of
seeking to transfer my good fortune to himself. The lower he sees
his cause sunk, the more likely he is to attempt to re-establish it by
some desperate expedient. And see that she don’t drive the
unfortunate Ambrose mad by her affectionate assiduities, if you
can.”
“Will you tell me you think I’m able for it, General?”
Sir Harry chuckled. “Give the poor fellow the support of your
presence when possible. But don’t attempt to dissuade your sister
from a close attendance on him, for you’ll get the worst of it. Never
interfere with a woman in her own province. She knows what will
bring her consolation, though you mayn’t realise it. That’s the advice
of one who has had a good deal to do with women.”
“I’m sorry the association has been so unfortunate as to teach
you such wisdom, General.”
“You young dog!” Sir Harry turned back on the verandah step
and chuckled again. “But you’re wrong there. I thank Heaven no
woman has ever known sorrow through me. Many are the tears I
have kissed away, but never caused one to flow. And you are
thinking, you irreverent young rascal”—with a renewed chuckle
—“that to be kissed by a battered old phiz like mine would be more
likely to draw tears than to allay ’em. I know you young fellows!”
“I wouldn’t dream of such a thought, sir!” with virtuous
indignation. “But all the same, I’d give a good deal to be sure you
don’t draw floods of ’em from my little Sally when I ask you for her,
before you say yes!” he added sotto voce, as he supported himself
by the pillar while Sir Harry mounted his horse and called out a
farewell message to Eveleen.
CHAPTER XX.
IF SHE WILL, SHE WILL.
Still the storm tarried. Supper was served, and Eveleen made a
pretence of eating, lest the servants should attribute her lack of
appetite to fear. Then they went away to have their food—Ketty
eating in self-righteous solitude, while Abdul Qaiyam fraternised with
the boatmen, who had kindled a fire on the island to cook their rice.
Eveleen envied them as they sat in the smoke, for it served to keep
away mosquitoes and other flying pests, while she durst not light a
candle for fear of filling the cabin with the winged intruders. Alone
with her unconscious husband, she kept a dreary vigil, fearful of she
knew not what. She remembered that Richard had seemed about to
say something when the boat with the guards came up, but the
momentary impulse had passed, and he had shown no inclination to
speak since. What was it that had troubled him? Could it be that he
had recognised any of the men? But even so, what could the guards
do, even if ill-disposed? They might intend robbery, but the modest
belongings of the pair would be poor booty compared with the
danger of provoking the certain vengeance of the Bahadar Jang. Or
if they were indeed adherents of the Khans, their object might be
simply to avenge the wrongs of their former masters; and Eveleen
shuddered as she remembered what had befallen an invalid officer,
on his way down the river, at the hands of some of Khair Husain
Khan’s servants. Dragged from his boat shivering with fever, the sick
man had pleaded with the robbers, as he thought them, to leave
him his clothes, because he was so cold, and they had responded by
cutting off his head. Sir Harry had acted as might have been
expected of him, informing the Khan he would hang him from the
round tower of the Fort unless the guilty servants were given up.
They were produced in an hour, and suffered the penalty their
master escaped, though it went sorely against the grain with Sir
Harry to spare Khair Husain and punish his tools. That example
ought to serve as a salutary warning, surely?
But Eveleen could not take comfort. The servants had returned
and made things ready for the night, and she had lain down on her
bed, though knowing she could not sleep. Every sense seemed to be
more than commonly alive, as though the coming storm, which had
lulled Richard into lethargy, merely stimulated her. Theoretically no
one was awake within miles of her—for what was the use of posting
sentries on an uninhabited island in the middle of a wide river?—but
the air was full of little unaccountable noises. A feeble soughing wind
that went and came, distant irritable growlings of the storm, the
rattling, rather than rustling, of the withered grass and rushes—
these sounds she could identify, but there were others whose
meaning eluded her. Of course it was only the lapping of the water
that sounded like whispers, and when one might think some one had
dropped a weapon it was merely the snapping off of a dead branch
by its own weight; but she wished they would not happen. The
blinds at the ends of the cabin were rolled up to allow the free
passage of air, and she lay looking out at the leaden sky, with no
companionable stars to brighten it, and listening to the sounds, and
there fell upon her at last an agony of terror. It had always been her
boast that she did not know what nerves were, but she would never
make it again. The beating of her own heart sounded to her like the
rise and fall of a tremendous piston, such as she had once heard in a
Dublin factory, filling the whole earth and sky; and as she cowered
before its relentless thud, she trembled with cold, though the
slightest movement made her aware that her whole frame was
streaming with perspiration. She who had been afraid of nothing was
afraid of everything—the place, the time, the weather, the solitude,
the company, the silence, the sounds,—what she saw and what she
did not see.
She shook herself angrily free from the overmastering terror at
last—or at any rate, which perhaps showed equal courage, she acted
as if she did. Struggling from the bed and to her feet—for she found
she must put forth all her strength, as though she were really being
held down by a powerful hostile hand,—she threw on a dressing-
gown and groped her way forward. The old bearer, curled up like a
dog beside his master, heard her and looked up curiously: she saw
his bright eyes like a dog’s in the dark, lighted by some gleam
behind her, perhaps the ashes of the dying fire on the shore. She
stood looking out, but there was nothing to see. Dark sky, dark
water—a perfect pall of darkness brooding over everything,—and on
her left a slightly deeper darkness which showed the position of the
island and its ragged grass and shrubs. The voices of the night were
whispering as before, and again she felt that terrible sensation of
helplessness. Once she opened her lips to pray, but her pride was
not broken yet. “And how would I pray,” she asked herself sharply,
“when I know every bit of it’s my own doing?”
She staggered as she spoke, and caught at the framework of
the cabin to steady herself. What had made the boat lurch suddenly
—some wave which was the result of the storm higher up, its
precursor here? She looked more narrowly at the water. Was it fancy,
or did she see round things moving in it? And surely there were
strange amorphous shapes where there had been none before? Her
heart stood still. The change, if change there was, was so soundless,
so ghostly. But the thought of the supernatural passed from her
mind with a shock. The boat was moving. Not merely swaying at its
moorings as the current tried to suck it away from the protecting
island, but moving out into the stream and leaving the island behind.
Wild thoughts of crocodiles rushed into her mind. Could they
possibly bite through stout ropes and tow a boat along, or even
leave it to float at its own sweet will? Impossible; there must be
human agency at work. With Eveleen to think was to act, and
kneeling precariously at the side of the boat, she leaned over the
gunwale and clutched at one of the round objects she had thought
she saw. The yell of horror which came from it told her what the
sense of touch told also, that it was a human head. The boat was
surrounded by swimming men, who were moving it away from the
island—presumably it was also being towed by a rope. But what the
great shapeless objects were, which she seemed to see beyond the
heads, she could not tell, nor did she trouble to conjecture. Whether
she or the man she had grasped was the more astonished might be
doubtful, but she had the advantage of position. Catching up an
earthen water-pot which stood outside the cabin for the sake of
coolness, she hurled it in the direction of the yell, and was on her
feet in a moment and under the mat roof. When she came out,
Richard’s pistols were in her hand, and she fired one in the direction
of the island as a signal. She could not believe that Mr Firozji was
concerned in any plot that might be toward, and if he was a man at
all he would come to the rescue with those guards of his.
The immediate response to her signal was a startling one. She
had barely time to recharge the pistol, working clumsily in the dark,
before there was a hasty movement of men aft—whether the
boatmen or the swimmers she could not tell, nor was she much
concerned to know. At the moment she was more conscious of
Abdul Qaiyam’s heavy breathing close beside her as he asked in a
bewildered voice whether the Beebee had shot anybody than of her
possible assailants. Hurriedly she thrust the ammunition pouch at
him.
“Load when I pass y’a pistol!” she said sharply, and then called
out in her imperfect Persian to the men in front that if any one came
nearer she would shoot him. One man sprang forward, and she fired
at him point-blank. The blind shot in the dark must have taken
effect, for the man cried out and fell forward. Confused cries of rage
and protest came from the rest, and Eveleen held her hand. For the
moment she had thought of discharging all the three shots she had
left into the group, in the hope of driving them overboard at once,
but the imprudence of leaving herself defenceless, even for a
moment, was reinforced by mystification. The whole thing was like a
bad dream—the shapes in the water, the moving crowd dark against
the dark sky, the eager talking in an unknown tongue. If it was
Persian, her knowledge of the language was quite inadequate to
cope with it. She stooped a moment towards Abdul Qaiyam as he
handed her the recharged pistol.
“Speak to them!” she said imperiously. “Ask them who they are
—what they want. Tell them we are well armed, and can see them
though they can’t see us.”
The old man was too much terrified to obey immediately, and
she thrust at him impatiently with her foot. Then his quavering voice
made itself heard—“Brothers!” and the men in front appeared to
listen. One of them stepped forward a little.
“Stand back, or I fire!” said Eveleen quickly, and the bearer
repeated the words in Persian. As he spoke, she remembered
suddenly that she must be visible to any one able to see through the
cabin from end to end, and she sank on her knees, resting the barrel
of the heavy pistol on the back of a camp-chair which she pulled
noiselessly towards her. Crouching thus, she was invisible to those in
front, and a barrier—if a frail one—between Richard and the enemy.
But were they enemies, or was there some absurd mistake? She
could not decide, but she felt fairly certain that what they had been
speaking was not Persian, though the spokesman—who had
withdrawn a pace or two hastily before her threat—was using that
language with Abdul Qaiyam.
“These are very bad people,” the old man murmured to her at
last, and she listened without turning her head. “Kajia tribe—they
come to steal the boat—everything.”
“Nonsense! they’ll not do anything of the sort. Where will the
Parsee be, now? letting this kind of thing happen instead of coming
to help us.”
To her amazement the meek voice of Mr Firozji answered her—
apparently from somewhere close at hand. In her bewilderment she
suffered her gaze to stray for a moment, and discerned dimly that
he was just outside the boat, but seemingly not in the water. At
least, his voice was on a level with the gunwale, though there was
no grating sound to show that another boat was rasping alongside.
The mad incomprehensibility of the situation was more
incomprehensible than ever.
“The Beebee beholds in me a son of misfortune,” he said
pathetically. “The Kajias have deceived me. They have stolen the
boat, so as to carry away the Sahib, the Beebee, myself, the servant
people—all.”
“And what may those guards of yours be about, to let them do
it? Call them, can’t you? Shout!”
“The Kajias would slay me,” in affright. “The guards are asleep.”
“Much good they are! But what do the Kajias want to do with
us? We’d be no good to them to steal.”
“Are they not taking us to their camp?” he suggested doubtfully.
“Well, they won’t, then. Tell them to go back and leave us on
the island, and take the boat if they want it.”
“They say the water will soon be rising, and we should all be
drowned. They refuse to leave us.”
“Sure they’re very considerate! Well, tell them we won’t go to
their camp—or if we do, there’ll be precious few of them will take us
there. I have plenty of shots here, and I’ll use them all first.”
“What does the Beebee please to desire?” was the question
asked after some interchange of conversation between Mr Firozji and
the captors. Eveleen had employed the interval in thinking hard. She
did not believe the Kajias meant to take their victims to their camp—
or if they did, it was merely for the sake of killing them more at their
leisure. It was in the highest degree unlikely that they would leave
witnesses alive to testify against them, or provoke Sir Harry further
by attempting to hold them to ransom. No, what they had no doubt
intended was to tow the boat out of earshot of the sleepy guards on
the island, and then cut the throats of all on board, and gut the
vessel and send her adrift, in the comfortable conviction that nothing
but unrecognisable fragments would survive the storm. This seemed
the more certain from their bringing with them the means of getting
to shore again, for the mysterious shapes—on one of which Mr
Firozji was uncomfortably poised, like a river-god in difficult
circumstances—were obviously the mashaks, or inflated skins, with
the help of which the tribes on the banks were in the habit of
making such short voyages as they found necessary. How they had
managed to abstract the poor little man from his own boat, under
the eyes of his servants, was a mystery, but everything was
mysterious to-night.
He repeated his question as Eveleen hesitated a moment.
“Why, let them take us over to the other side,” she answered—
the desire to be as far as possible from the Kajias conquering all
other considerations. “I’d rather choose the desert than their camp.”
“There is no time. They are afraid of the storm.” Mr Firozji’s
voice sounded as if he was frightened himself.
“Well, they may say whether they’ll be shot, or drowned in the
storm. I’d much rather be drowned——” She stopped suddenly, for
the second pistol, which had lain beside her knee, was hastily
withdrawn, and a shot rang out behind her. Then she laughed rather
wildly, for the deferential voice of the old bearer murmured—
“This humble one made bold to fire at one of the sons of
wickedness who was climbing into the boat behind the Beebee’s
back.”
“Quite right!” she said, still laughing, then turned sharply upon
Mr Firozji. “Tell them they are wasting time. If the storm overtakes
us ’twill be their fault. I’m tired of this. Let them make up their
minds.”
Again there was a prolonged conversation, and apparently the
Kajias gave a grudging assent to the condition. “If the Beebee is
determined to drown all of us and the Kajias too, she must,”
remarked Mr Firozji sourly as he scrambled on board the boat,
having taken the opportunity of putting in a word for himself in the
course of the negotiations. Yet Eveleen had the idea that he was not
really displeased, and she wondered whether he could possibly be in
league with the Kajias after all. But the notion seemed so absurd
that she banished it again, though disregarding coldly his hints that
the night air was unhealthy, and refusing to invite him into the cabin.
The Kajias—or the boatmen—or perhaps they were the same: it was
impossible to see—were very busy, working with an alacrity rather
surprising in the circumstances. There was a slight chill breeze to be
felt now, and they were hoisting the sail, and also getting out their
poles. Were they really indifferent which bank they landed on, or
were they plotting further treachery? As noiselessly as she could,
Eveleen supplemented the chair which served her as a parapet by
such other pieces of furniture and packages as she could reach, and
whispered to Abdul Qaiyam to do the same at the other end of the
cabin, entrusting him with one of the pistols. In feeling about, she
came across Ketty, who had preserved such an unwonted silence
during the stirring events of the last half-hour that her mistress had
forgotten all about her. But she had been employing her time to
advantage, as Eveleen discovered when she found her dressing-case
open and largely denuded. Her handmaid had been removing such
fittings as were of convenient size, and concealing them about her
person.
“What in the world are you doing, Ketty?” The tone would have
been louder but for prudential reasons.
“What madam doing without her things?” was the self-righteous
reply, calculated to make Eveleen repent her unjust suspicions. Were
they really unjust? she wondered.
“Well, I hope y’are taking care of the Sahib as well,” she said.
“He needs much more than I do.”
The sniff with which Ketty replied suggested that she considered
this would be trespassing on Abdul Qaiyam’s province, but her
mistress had no time to see whether she was obeying or not, for
there were other things to think of. The tardy storm was coming up
at last, heralded by the breeze which was taking the boat across the
stream. Great drops of rain were falling like bullets on the cabin roof,
and the air was full of a hissing noise. The boat was in the main
stream now, and the boatmen drew in their poles, and evidently
settled down to hold tight and hope for the best. The river seemed
bewitched, cross-currents driving the boat now this way, now that,
and the men who were managing the clumsy sail had no easy task.
The vessel was not built for rough weather, her draught being too
shallow and her deck-load too heavy. She bounced and bobbed
about, shipping a good deal of water, and hurling all the loose things
in the cabin from side to side with every lurch. Fearful of a surprise,
Eveleen durst not leave her post even to see that Richard was safe,
and had to take what comfort she could from the knowledge that his
charpoy was fixed to the deck. By the sounds she heard, she
gathered that the two servants were in the throes of sea-sickness,
and she wondered dismally what would happen if she herself were
prostrated by it as on the voyage from Bombay. But her mental
preoccupation probably saved her, and she was able to maintain her
watch. Sheets of rain were falling now, and she was soaked to the
skin, but did her best to shelter the pistol under the wadded quilt
she dragged from her bed. The lightning was almost continuous, and
whenever the howling and shrieking of the wind would allow, the
rolling thunder filled up any pauses. The boat appeared to have
embarked with enthusiasm on a series of experiments—now trying
to stand on her head, now on her tail, and then seeing how far she
could heel over without actually dipping gunwale under. It was
wonderful that the mast did not go, though the great sail had been
partly torn and partly cut away, and replaced by a tiny one which
just kept the vessel before the wind. By the flashes of the lightning
Eveleen noted grimly the miserable huddled figures forward, and
guessed that the Kajias were not particularly happy in their
conquest.
“If only there was a man on board worth a halfpenny—barring
my poor Ambrose,” she said to herself, “we’d retake the ship in no
time. But who is there at all? Firozji is no mortal use; if Bearer can
fire a pistol, that’s the most he can do; and as for the boatmen, if
they ain’t Codgers themselves, they’re every bit as bad. Indeed and
they’re worse, for they ain’t sea-sick.”
Her self-communing was interrupted by a tremendous clap of
wind, which came down on the boat as though determined to end
her gambols at one blow. But once more she righted herself, though
the cabin roof was torn bodily from its supports and carried gaily
down the river. Eveleen’s heart failed her until she had assured
herself, by groping and feeling, that Richard and the two servants
were still there. The roar and crack had been so overwhelming that
for the moment she fully believed the boat had broken in two, and
they were all so wet already that the exposure to the rain hardly
signified. Moreover, the loss of the mast and the cabin made the
boat decidedly steadier, though Eveleen was less grateful for this
than might have been expected, since she saw distinct signs of
returning animation among the captors when the lightning made
them visible. Could they be nearing the shore? she wondered. How
long they had been tossing about, yet on the whole forging
eastwards, she could not tell, but now that the lightning was less
continuous, it seemed to her that between the flashes the darkness
was not quite so in tense. It was a poor prospect—to be turned out
on an unknown shore with a sick man and two frightened servants;
but the expectation of treachery was so strong in her mind that she
would have been thankful if they had been already there. Certainly it
was not goodwill on the part of the Kajias that had induced them to
undertake a voyage of so much danger and difficulty to get rid of
their prisoners, with the prospect of another even more difficult and
dangerous in getting back to their own side of the river; what then
was it? It was not fear. During her tempestuous vigil she had seen
that clearly. Her bluff before the storm had been spirited, but at any
moment she might have been rushed from behind and thrown
overboard, or a man on a mashak, shooting at the sound of her
voice in the dark, might have crippled or killed her without the
slightest risk to himself. It could hardly be vengeance, since—though
it might involve more suffering to your captives to maroon them on
the barren shore where they had mistakenly asked to be placed than
to kill them and dispose of their bodies in the river—their sufferings,
which you would not see, would hardly be sufficient compensation
for the risk to yourself involved in getting them there. Mr Firozji, too.
A certain complacence about the little man’s manner led Eveleen to
the conclusion that the greater part of his merchandise must consist
in precious stones hidden about his person, so that he could regard
lightly the loss of all the rest. But if she could guess this, so could
the Kajias, and were they really going to allow him to escape with it?
The whole thing—like all the events of the night—was beset with
riddles, and all that could be done was to keep a sharp watch
against surprise. But in what direction? Eveleen did not know where
to look, and moreover, the unceasing strain of the last few hours
was telling upon her. She had been soaked so repeatedly that she
could hardly remember what it was to feel dry and warm; she was
aching in every limb, and—what was worse—her eyes would hardly
keep open. In spite of the misery of body and anxiety of mind which
had already endured so long, she began to find her eyelids closing
involuntarily and imperceptibly, when she knew she ought to
redouble her vigilance of the night now that dawn would soon give
her enemies the advantage. She had no longer even the shelter of
the cabin from which to fire, and her poor attempt at a barricade
had been disintegrated long ago, and its component parts strewn
upon the waters. She turned her head with difficulty, and saw—yes,
the light must be increasing, since now she could see dimly Richard’s
white face as he lay stark and stiff, like a dead man, on the charpoy,
which was fortunately fixed against the framework of the cabin at
the corner where it had suffered least, the old bearer crouched
beside him, one hand clenched on the pistol, and Ketty hunched up,
like a little old monkey, nearer to herself. They were defenceless but
for the two pistols—even if the charges were not too damp to fire.
The Kajias could shoot them down without the slightest risk, or—
supposing their matchlocks also were useless, or their powder too
precious to waste on such game—kill them with their knives with
little danger to themselves. Why had they not done it long ago?
With equal difficulty Eveleen turned again towards them, where
they sat huddled in the bow, with the boatmen as a sort of neutrals
between, and Mr Firozji, with chattering teeth, crouching alone as
though disowned by all parties. The men in the bows were
beginning to lose something of their despairing attitude—taking an
interest in things again, and exchanging a word or two with one
another. She could see them, though in the driving rain she could
not hear them; and she tried to pierce the veil of moisture ahead,
and see if land were visible. But as yet she could see nothing but a
grey expanse of angry water, yellow in streaks with sand, and
bearing on its bosom uprooted trees and brushwood, with the grey
sky overhead and the grey curtain of rain between. She tried to
collect her thoughts and devise some way of getting Richard ashore
—when they reached the shore. But what kind of shore would it be
—high and rocky, or the endless flat land over which the flooded
river must now be crawling relentlessly? How could she decide till
she knew?
The end came suddenly—so suddenly that for the moment she
thought she must have been asleep, and missed what led up to it.
The boatmen had their poles out again, the keel was grating on
ground of some sort, and yet there was still nothing to be seen but
the river and the rain. But to the accustomed eyes of the Kajias
more must have been visible, for they were standing up and talking
eagerly. She noticed indifferently what big strapping fellows they
were—picturesque despite their drenched clothes and shapeless
turbans, and the ringlets, of which they were ordinarily so proud,
lying limp and straight on their shoulders and mingling with their
beards. The absurd reflection occurred to her that the rain must
have washed them a little clean, which would be a strange
experience to them. One of them turned round and kicked Mr Firozji,
saying something to him, and the old Parsee stumbled up from the
deck and addressed Eveleen in his beautiful Persian, which she
found so difficult to understand.
“The boat can go no farther—the water is shallow——” his
words tumbled over one another. “The boatmen will carry the
Beebee ashore, if she will promise not to shoot.”
“Let them take the Sahib first,” said Eveleen promptly, then
hesitated. How could she let them carry Richard away out of her
sight, not knowing where they were taking him? Better go first
herself. And yet how could she know how roughly they might handle
him if she and her pistol were not there? “Won’t you go first
yourself?” she asked eagerly. “Then you can see that they put Major
Ambrose down carefully, and I will come last.”
Mr Firozji’s face was ashy. “I fear—I greatly fear,” he
stammered. “I have the conviction that they will kill me if I leave the
Sahib and the Beebee.”
Clearly there was no help here. She must take the risk. She
turned to Abdul Qaiyam. “Watch over the Sahib, bearer; see that
they carry him properly on the charpoy. Fire the pistol if they are
rough, and I will come back. I can’t be any wetter than I am,” she
added to herself, and rather wondered that the captors should offer
to put her ashore instead of letting her wade. But when she was
mounted on the shoulders of a sturdy boatman, with another close
at hand in case of accidents, she saw how bad the footing was, and
how confusing the currents even in this shallow water. Just as they
started she heard a resounding splash, and looking round, was
touched to see that Ketty had deliberately thrown herself—or rather
let herself—into the water from the boat’s side, and was struggling
after her, clutching the scanty drapery of the second boatman. The
water was up to the old woman’s chest, but she pushed on bravely,
and though the men on board laughed, they did not attempt to stop
her.
How far the two men waded Eveleen did not know. The boat
was only dimly visible as a misty shape through the falling rain when
they reached land as suddenly as they had discerned it earlier. It
was land in the sense of not being covered with water, but it
resembled nothing so much as a sandbank left bare, though not dry,
by the retreating tide. Yet apparently it was not an island, for it
seemed to rise slightly on the side away from the boat, and to
continue rising; and when Eveleen felt her feet on firm ground once
more, her spirits went up with a bound. Anything was better than
that dreadful boat and the company it carried, and when the rain
stopped—which it must do soon now—they would quickly be dry and
comfortable, and could look for some village where there was food
and shelter to be found. She said as much to Ketty as they stood
looking after the two men, whose forms were soon swallowed up in
the driving rain. Most incomprehensibly, Ketty laughed; but before
Eveleen could demand the reason, her cheerful anticipations were
rudely contradicted by the sound of a shot from the boat, with cries
and the muffled noise of a struggle. Unheeding Ketty’s agonised
entreaties and attempt to hold her fast, she dashed into the water
and began to wade back. The boat seemed farther away than she
had been—and surely the boatmen were poling her off? Eveleen
gave a great cry as the truth burst upon her, then struggled on
again, though with failing strength, hindered by her clothes and the
treacherous sand. Somehow or other she reached the boat when the
water was up to her shoulders, and clung convulsively to the
gunwale, shrieking to her husband to wake, to escape, to save
himself, to save her. Mr Firozji lay on the deck in a pool of blood, and
the murderers were already stripping off his clothes in search of
booty. In front of his master stood Abdul Qaiyam—a most unheroic
hero, with the pistol wavering in a shaking hand, and a face grey
with fear. A man with a tulwar sprang at Eveleen as she clung to the
side, and brought down his weapon with a horrible sweep. In terror