0% found this document useful (0 votes)
25 views

Node js Recipes A Problem Solution Approach 1st Edition Cory Gackenheimer pdf download

The document provides information about downloading and accessing various programming ebooks, particularly focusing on 'Node.js Recipes: A Problem-Solution Approach' by Cory Gackenheimer. It outlines the installation process for Node.js across different operating systems and introduces npm, the package manager for Node.js. Additionally, it discusses the CommonJS module system used in Node.js for managing modules and dependencies.

Uploaded by

davajialeexa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Node js Recipes A Problem Solution Approach 1st Edition Cory Gackenheimer pdf download

The document provides information about downloading and accessing various programming ebooks, particularly focusing on 'Node.js Recipes: A Problem-Solution Approach' by Cory Gackenheimer. It outlines the installation process for Node.js across different operating systems and introduces npm, the package manager for Node.js. Additionally, it discusses the CommonJS module system used in Node.js for managing modules and dependencies.

Uploaded by

davajialeexa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Visit https://ebookultra.

com to download the full version and


browse more ebooks or textbooks

Node js Recipes A Problem Solution Approach 1st


Edition Cory Gackenheimer

_____ Press the link below to begin your download _____

https://ebookultra.com/download/node-js-recipes-a-problem-
solution-approach-1st-edition-cory-gackenheimer/

Access ebookultra.com now to download high-quality


ebooks or textbooks
Here are some recommended products for you. Click the link to
download, or explore more at ebookultra.com

Swift Recipes A Problem Solution Approach 1st ed. Edition


Rogers

https://ebookultra.com/download/swift-recipes-a-problem-solution-
approach-1st-ed-edition-rogers/

R Recipes A Problem Solution Approach 1st Edition Larry A.


Pace

https://ebookultra.com/download/r-recipes-a-problem-solution-
approach-1st-edition-larry-a-pace/

Android Recipes A Problem Solution Approach 2nd Edition


Dave Smith

https://ebookultra.com/download/android-recipes-a-problem-solution-
approach-2nd-edition-dave-smith/

BizTalk 2013 Recipes 2nd Edition A Problem Solution


Approach Mark Beckner

https://ebookultra.com/download/biztalk-2013-recipes-2nd-edition-a-
problem-solution-approach-mark-beckner/
Visual Basic 2008 Recipes A Problem Solution Approach 1st
Edition Rakesh Rajan

https://ebookultra.com/download/visual-basic-2008-recipes-a-problem-
solution-approach-1st-edition-rakesh-rajan/

WPF Recipes in C 2008 A Problem Solution Approach 1st


Edition Sam Bourton

https://ebookultra.com/download/wpf-recipes-in-c-2008-a-problem-
solution-approach-1st-edition-sam-bourton/

PHP and MySQL Recipes A Problem Solution Approach 2nd


Edition Frank M. Kromann

https://ebookultra.com/download/php-and-mysql-recipes-a-problem-
solution-approach-2nd-edition-frank-m-kromann/

ASP NET Web API 2 Recipes A Problem Solution Approach 1st


Edition Filip Wojcieszyn

https://ebookultra.com/download/asp-net-web-api-2-recipes-a-problem-
solution-approach-1st-edition-filip-wojcieszyn/

Deploying Node js 1st Edition Pasquali

https://ebookultra.com/download/deploying-node-js-1st-edition-
pasquali/
Node js Recipes A Problem Solution Approach 1st
Edition Cory Gackenheimer Digital Instant Download
Author(s): Cory Gackenheimer
ISBN(s): 9781430260585, 1430260580
Edition: 1
File Details: PDF, 4.17 MB
Year: 2013
Language: english
www.it-ebooks.info
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.

www.it-ebooks.info
Contents at a Glance

About the Author������������������������������������������������������������������������������������������������������������� xxiii


About the Technical Reviewers���������������������������������������������������������������������������������������� xxv
Acknowledgments���������������������������������������������������������������������������������������������������������� xxvii

■■Chapter 1: Understanding Node.js�������������������������������������������������������������������������������������1


■■Chapter 2: Networking with Node.js��������������������������������������������������������������������������������27
■■Chapter 3: Using the File System������������������������������������������������������������������������������������51
■■Chapter 4: Building a Web Server������������������������������������������������������������������������������������81
■■Chapter 5: Using Events and Child Processes���������������������������������������������������������������109
■■Chapter 6: Implementing Security and Cryptography���������������������������������������������������133
■■Chapter 7: Discovering Other Node.js Modules�������������������������������������������������������������161
■■Chapter 8: Creating a WebSocket Server�����������������������������������������������������������������������191
■■Chapter 9: Using Web Server Frameworks��������������������������������������������������������������������221
■■Chapter 10: Connecting to a Data Store������������������������������������������������������������������������253
■■Chapter 11: Testing in Node.js���������������������������������������������������������������������������������������281
■■Chapter 12: Debugging and Deploying Your Application�����������������������������������������������311

Index���������������������������������������������������������������������������������������������������������������������������������339

www.it-ebooks.info
Chapter 1

Understanding Node.js

Node.js is a server-side framework useful for building highly scalable and fast applications. Node.js is a platform
that is built on v8, the JavaScript runtime that powers the Chrome browser designed by Google. Node.js is designed
to be great for intensive I/O applications utilizing the nonblocking event-driven architecture. While Node.js can
serve functions in a synchronous way, it most commonly performs operations asynchronously. This means that as
you develop an application, you call events with a callback registered for handling the return of the function. While
awaiting the return, the next event or function in your application can be queued for execution. Once the first function
completes, its callback event is executed and handled by the function call that invoked the callback. This event-driven
processing is described in Node.js’s very own definition:

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network
applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and
efficient, perfect for data-intensive real-time applications that run across distributed devices.

Applications written in Node.js are written in JavaScript, the ubiquitous language of the web platform. Because
of the accessibility of JavaScript to many experienced developers and newcomers alike, the Node.js platform and
community have taken off and have become critical parts of the development landscape for many companies and
developers.
This book is about Node.js. In particular this book is designed as a recipe book, which aims to provide a large set
of useful and high-quality examples of what Node.js is capable of accomplishing. This book is geared for a developer
who has some experience with JavaScript and at least some exposure to Node.js. By reading this book, you will gain
an understanding of many of the highly utilized modules, both those native to Node.js and those written by third-party
contributors, that are the main targets for Node.js developers.
This first chapter is a departure from the recipe format that will follow in the rest of the book. It is broken down
to get a developer up and running from scratch with installation and it gives an overview of how to function within
the Node.js platform. You will get an idea of how to install Node.js and understand many of the common paradigms
and the basic workflow to get a Node.js application running. As you will see, a considerable amount of time is spent
covering how Node.js works. Once you have read this chapter, you should be well equipped to dive into the recipes
in the chapters that follow.

1-1. Installing Node.js on Your Machine


There are several ways in which an install of Node.js can happen, and they vary slightly across different operating
systems. The three primary methods to install Node.js are via a binary installer, via a package manager, or by
compiling the source code.
To install Node.js on your machine via a binary installer, you first need the installer. Currently the only installers
that are available for Node.js are for Windows and Macintosh OS X. To find these installers, you need to go to
http://nodejs.org/download/. Here you will find your choice of installer to download as shown in Figure 1-1.

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

Figure 1-1. Platform-specific installers available for download

Windows
On Windows, first download the .msi installer package. When you open the file, you will begin your walkthrough with
the Setup Wizard, shown in Figure 1-2.

Figure 1-2. Beginning the install

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

As in most Windows applications, you will be presented with a default location to which you can install the
application files. This destination, however, can be overwritten and is presented to you as in Figure 1-3.

Figure 1-3. You can choose to use or overwrite the default file location

The last step before finalizing your install on Windows is to set up any custom configurations that you may want
for your Node.js installation. For example you could not add Node.js to your path; perhaps you want to test multiple
versions and will explicitly call the executable during your testing phase. This custom step is shown in Figure 1-4.

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

Figure 1-4. Custom setup

OS X
The installer on a Macintosh is very similar to the Windows setup. First, download the .pkg file. When you open this,
it will walk you through the standard installer that runs on OS X. This presents as you see in Figure 1-5.

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

Figure 1-5. Installing on OS X

Sometimes when installing Node.js, you want only a subset of the potential users to be able to access it.
This functionality is built into the OS X installer, presenting you with the option of how you would like Node.js
installed, as shown in Figure 1-6.

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

Figure 1-6. Installing for specified users

Just as on Windows, you can customize the installation. Click the Custom Install button and then set your
configuration accordingly as shown in Figure 1-7. For example, you may wish not to install npm, in favor of doing
a more customized npm install, which we will outline in the next section.

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

Figure 1-7. A custom Node.js install on OS X

There are, of course, many platforms that are not Macintosh or Windows, but you would still like to not have to
download and compile Node.js from sources. The solution for this is to find a package manager that will install Node.
js for you. There are several package management systems that vary across platforms, each with its own style for
fetching new packages.

Ubuntu and Linux Mint


The package for Ubuntu and Linux Mint requires that a few components be installed onto your machine before you
can install Node.js. To meet these prerequisites you must first run the code shown in Listing 1-1.

Listing 1-1. Ensuring Prerequisites Are Installed


sudo apt-get install python-software-properties python g++ make

You can then proceed with the installation by adding the repository that hosts Node.js, updating your sources,
and installing with the commands shown in Listing 1-2.

Listing 1-2. Installing Node.js on Ubuntu and Linux Mint


sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

Fedora
Fedora 18 has a simple Node.js install that is a single package manager directive, as shown in Listing 1-3.

Listing 1-3. Installing Node.js on Fedora


sudo yum --enablerepo=updates-testing install nodejs npm

In future versions of Fedora, Node.js should be integrated within the operating system by default.

Arch Linux
For Arch Linux, utilize the pacman package manager by targeting the “nodejs” package, as shown in Listing 1-4.

Listing 1-4. Installing via pacman on Arch Linux


pacman -S nodejs

FreeBSD and OpenBSD


An installation on Berkeley Software Distribution (BSD) platforms utilizes the ports installer, as shown in Listing 1-5.

Listing 1-5. Installing on BSD


/usr/ports/www/node

openSUSE
When using openSUSE you can install Node.js using the zypper command-line package management tool,
as shown in Listing 1-6.

Listing 1-6. Using zypper to install Node.js on openSUSE


sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_12.1/
NodeJSBuildService
sudo zypper in nodejs nodejs-devel

Many developers prefer utilizing package managers on OS X and even Windows as opposed to utilizing the
installers. Node.js can also be installed via these package managers.

Windows
Using the Chocolatey package manager, simply install with the chocolatey command, as shown in Listing 1-7.

Listing 1-7. installing Node.js on Windows with Chocolately


cinst nodejs

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

OS X
Whether you utilize MacPorts or Homebrew for your package manager on Macintosh, you can install Node.js in either
case as shown in Listings 1-8 and 1-9.

Listing 1-8. MacPorts


port install nodejs

Listing 1-9. Homebrew


brew install node

At this point you should have Node.js installed on your machine by using the method of your choosing on your
preferred platform. Next, you need to make sure you have a way to discover and manage Node.js packages.

1-2. Installing the npm Package Manager


Many programming languages and platforms depend on the use of third-party modules to extend the utility of the
platform. Node.js is no different in that it is greatly extended by the use of the package manager: npm. npm originated
separately from Node.js itself and is still maintained as an independent project. However, due to its growing
popularity and acceptance, it has been built and deployed with the Node.js binary installs since Node.js version 0.6.3.
This means that installing npm is as simple as grabbing the latest version of Node.js as outlined in the previous
section. So if you have used one of the binary installers, npm is already available to you. You can, of course, as shown
in the previous section, choose to omit npm from your install. If it appears npm is not available, you can run the
make install command and you will soon have it.
There are, as you might expect, less simple ways to install npm. These would be useful if you want to debug npm
or test a certain functionality that is not readily available in the default npm install. To get into the “fancy” installs,
you must first locate the install.sh shell script, which is located at https://npmjs.org/install.sh.
This installation shell script contains many tools for invoking npm in a way that meets your specific needs. For
instance, if you wish to create a debug mode instance of npm you could invoke install.sh, as shown in Listing 1-10.

Listing 1-10. npm debug Install


npm_debug=1 sh install.sh

You could also set configuration parameters with the npm install script, shown in Listing 1-11.

Listing 1-11. Additional Configuration Parameters for npm


npm_config_prefix=/my/path sh install.sh

Of course, you could build a patch for npm, in which case you will be best served to download from the GitHub
source and build it yourself. This requires running the make command in the folder that you have downloaded the
npm source to (see Listing 1-12).

Listing 1-12. Installing npm Manually


make install

With npm installed your machine is now set up to utilize the packages and modules that are easily accessed
through this package utility.

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

1-3. Understanding CommonJS Modules


Because Node.js is a framework in which programs are written in JavaScript, it carries with it some of the perceived
limitations that JavaScript has as well. One of these items that is missing is the concept of a robust standard library,
like one might find in a language like C++. Because of this, there are many variations and ways for including modules
within a JavaScript application. In the browser world, for example, this could be anything from simple <script> tag
ordering to script loaders to module loaders. For Node.js, a simple and robust module loading system is used quite
heavily though is not required. This modular system is known as CommonJS and represents the methods utilized
for sharing; it includes standard and third-party modules within your Node.js application.
CommonJS is a community-driven initiative that will bring a standard library-loading functionality to the
JavaScript community as a whole. What CommonJS actually represents is a set of specification proposals that will
aim to create a standardized system of module loaders. The concept of CommonJS modules is straightforward and
involves two parts. First, a creator of a CommonJS module should come up with a reusable piece of JavaScript and
export a specific objects or objects from this reusable JavaScript. Second, a consumer of the module will require the
exported objects from the module, which will then load into the application. The basic module contract as outlined
in the specification (http://commonjs.org/specs/modules/1.0/) is as follows:

Module Context
1. In a module, there is a free variable “require”, which is a function.
a. The “require” function accepts a module identifier.
b. “require” returns the exported API of the foreign module.
c. If there is a dependency cycle, the foreign module may not have finished executing
at the time it is required by one of its transitive dependencies; in this case, the object
returned by “require” must contain at least the exports that the foreign module has
prepared before the call to require that led to the current module’s execution.
d. If the requested module cannot be returned, “require” must throw an error.
2. In a module, there is a free variable called “exports” that is an object that the module may
add its API to as it executes.
3. Modules must use the “exports” object as the only means of exporting.

Module Identifiers
1. A module identifier is a string of “terms” delimited by forward slashes.
2. A term must be a CamelCase identifier: “ . ”, or “ . . ”.
3. Module identifiers may not have file-name extensions like “.js”.
4. Module identifiers may be “relative” or “top-level.” A module identifier is “relative”
if the first term is “ . ” or “ . . ”.
5. Top-level identifiers are resolved off the conceptual module namespace root.
6. Relative identifiers are resolved relative to the identifier of the module in which “require”
is written and called.

10

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

You can now examine what a simple implementation of a CommonJS module would look like. Assume you
create a file called “describe.js,” which will export a string of text that responds with a description of the module
shown in Listing 1-13.

Listing 1-13. describe.js Exporting a Description of Itself


/**
* Describe module
*/
exports.describe = function() {
return 'I am a CommonJS Module';
};

This module does not require any other modules to function; all that it does is export the describe function,
which returns a string description. But this is very uninteresting and if you wish to include this module within
your applications elsewhere, you need to install that module in your code. To do this, use the CommonJS require( )
function, as shown in Listing 1-14.

Listing 1-14. Requiring the describe Module


var describeModule = require('./describe.js');

Now you have a reference to your describe module, but what does that mean? What happens when you call
require( )? When you call require( ), Node.js will locate the resource and read and parse the file, granting you access
to the exported API of the module. When Node.js loads the file into your application, it will automatically isolate the
module into its own scoped namespace to prevent global names colliding in a disastrous thunder of crying. Because
Node.js has loaded this resource for you, you can call exported functionality from this resource (see Listing 1-15).

Listing 1-15. Reference an Exported Function from a Required Module


var describeModule = require('./describe.js');

console.log(describeModule.describe());

CommonJS modules are not entirely about exporting functionality either. They can be used to create an API that
builds on functionality with the module’s file but leaves that functionality private to the module itself. Imagine you
have a more robust module where only a certain portion of your module needs to be exposed; you can easily create
a method for this “private” functionality and still see it in the exported solution, as in Listing 1-16.

Listing 1-16. “Private” Methods in Exported Modules


/**
* Desc module with private method
*/
var _getType = function() {
return 'CommonJS Module';
};

exports.describe = function() {
return 'I am a ' + _getType();
};

11

www.it-ebooks.info
Chapter 1 ■ Understanding Node.js

You will see more about authoring and consuming CommonJS modules later, but, for now, the important
takeaway is how this all works. CommonJS modules export functionality, and only the explicitly exported functionality
is exported. Other functions or methods may live with the CommonJS modules, but they are limited to the private
scope of the module itself and not to the application that accesses the module. This can result in very clean APIs for
your application if you are careful and structure your CommonJS modules appropriately.
Understanding how Node.js implements the CommonJS methodology for module loading helps you to think
creatively about the structure and API of your application, allows for code sharing and reuse, and makes your
application code cleaner and easier to follow.

1-4. Writing Modules for Your Application


Now that you understand what CommonJS is and how it pertains to Node.js as a module loader, you can begin to
think about how you will build your own modules for your application. If you decide not to build modules for your
application, you will quickly see your application code grow unwieldy and cause you maintenance nightmares, with
heterogeneous data structures, objects, and callbacks strewn throughout what will become a monolithic Node.js
application.
When you begin thinking about writing your modules, the first thing that should come to mind is a simple
division of tasks. If your application requires a user to authenticate against a server in order to access content, you will
likely want to create a module for your user data. This could hold the session state, user information, authentication
protocols, and more. If you include this chunk of user-specific data at the heart of your Node.js application, you will
regret having to navigate past or around this code every time you see it. Listing 1-17 shows how these data might look
when your application lacks modules.

Listing 1-17. Messy Code with Exportable Features


/**
* User authentication code not in its own module
*/

var db = require('./db.js');

app.on('/createUser', function(req, res) {


var user = req.username,
pwd = req.password,
email = req.email;

db.lookup('user', {username: user }, function(err, data) {


if (err) {
return;
}
// Didn't find a user by that name
if (data.userid === null) {
createSalt(10, function(err, salt) {
if (err) {
return;
}
createHash(pwd, salt, function(err, hash) {
db.create('user', {username: user, password: pwd, email: email }, function(err, user) {
if (err) {
return;

12

www.it-ebooks.info
Exploring the Variety of Random
Documents with Different Content
development of home manufactures, the reclamation of many waste
spaces through the operation of enclosure Acts, and the
improvements brought about in cultivation. The need for better
means of communication in order to open up districts then more or
less isolated, to provide better transport for raw materials and
manufactured goods, and to facilitate the carriage of domestic and
other supplies needed by the increasing population, thus became
more and more apparent.

In many instances the condition of the roads and the prejudicial


results upon them of heavy traffic were adduced as the main reason
for a resort to improvements of river navigation. An Act (21 Jas. I.,
c. 32), passed in 1624, for deepening the navigation of the Thames
from Bercott to Oxford, stated that it was designed "for the
conveyance of Oxford freestone by water to London, and for coal
and other necessaries from London to Oxford, now coming at a dear
rate only by land carriage, whereby the roads are becoming
exceedingly bad." It was further stated, in the preamble, that "the
said passage will be very behoveful for preserving the highways
leading to and from the said university and city and other parts
thereabouts" which, owing to "the continual carriages by carts," had
become dangerous for travellers in winter, "and hardly to be
amended or continued passable without exceeding charge." In 1739
there was passed an Act (14 Geo. II., c. 26), "for the betterment and
more easy and speedy portage" on the Medway of timber from the
woods of Sussex and Kent, which timber could not be "conveyed to
a market but at a very large expense by reason of the badness of
the roads in these parts."

Various far-seeing, patriotic and enterprising individuals took a


leading part in pioneering the movement in favour of improved river
navigation which, for a period of about 100 years—until, that is, the
advent of the canal era—was to be developed with much zeal and
energy, though not always with conspicuous success. Especially
prominent among these pioneers were William Sandys, Francis
Mathew and Andrew Yarranton; and it is only fitting that some
mention should here be made of these three worthies, each of
whom shared the fate of so many other pioneers, in so far as he was
a man in advance of his time.

Sir William Sandys, of Ombersley Court, in the county of Worcester,


obtained, in 1636, an Act of Parliament which granted powers for
making navigable the Warwickshire Avon from the Severn, at
Tewkesbury, to the city of Coventry, and, also, the Teme, on the
west side of the Severn, towards Ludlow. Some of the works thus
carried out are still rendering good service. In 1661 he secured
further Acts for making navigable the rivers Wye and Lugg and the
brooks running into them in the counties of Hereford, Gloucester and
Monmouth. Here he anticipated much of what was to be done a
century later by Brindley, in connection with canal construction,
inasmuch as he obtained powers not simply to deepen the beds of
the rivers and to straighten their courses, but to construct new
channels, to set up locks, weirs, etc., to provide towing-paths, and to
dig new channels where required. This last-mentioned proposal
constituted, as will be seen later on, the idea that led up to the
eventual transition from navigable rivers to artificial canals, the new
"cuts" on the former being the connecting link between the two.

The Wye was found to be an exceptionally difficult stream to tame


and control, and Sandys' attempt to make it navigable by locks and
weirs on the pound-lock system was a failure. The scheme was,
however, afterwards carried through on different lines; and in
summing up the results John Lloyd, Junr., says in "Papers Relating to
the History and Navigation of the Rivers Wye and Lugg" (1873):—

"Although, through the uncertainty of its stream, the Wye was never
brought to answer the purpose of a regular conveyance, its
navigation has proved of great service throughout the county of
Hereford. Throughout the last[21] century most of the coal
consumed in Hereford and its neighbourhood was brought up in
barges after a flood. Various other heavy articles, such as grocery,
wines and spirits, having been first conveyed from Bristol to
Brockweir in larger vessels, were carried up thence in barges at a
much easier rate than by land carriage. In return the boats were
freighted with the valuable oak timber, bark, cider, wheat, flour and
other produce of the county. The opening of the towing-path for
horses by the Act of 1809 gave a further impetus to navigation, and
especially to the trade in coal from Lidbrook, and while every river-
side village could boast of its quay and its barge, the quay walls at
Hereford were thronged with loading and unloading barges....

"Since the opening of the Hereford, Ross and Gloucester Railway, in


1855, and the consequent dissolution of the Towing-path Company,
nearly all navigation on the Wye above Monmouth has ceased."

Francis Mathew addressed, in 1655, to Oliver Cromwell, "Lord


Protector of the Commonwealth," a powerful argument in favour of
"The Opening of Rivers for Navigation," the benefit thereof which he
sought to show being, as his title-page said, "exemplified by the Two
Avons of Salisbury and Bristol, with a Mediterranean Passage by
Water for Billanders of Thirty Tun between Bristol and London." The
writer described his little book as a plea that "England's fair valleys
and rich Inlets through which so many noble Rivers insinuate
themselves might with the imitation of the industrious Netherlanders
be made in many places docible of Navigation, to the inestimable
comfort, satisfaction, ease and profit of the publick." "Rivers," he
further observed, "may be compared to States-men, sent abroad;
they are never out of their way so they pass by great Cities, Marts,
Courts of Princes, Armies, Leaguers, Diets and the like Theatres of
Action, which still contribute to the increase of their Observation; So
Navigable Rivers, the more places of Note they pass by, the more
they take up, or bring, still gleaning one Commodity or other from
the Soyl they pass through, and are supplied by every Town they
touch at with imployment."
Into the details of his scheme for establishing direct water
communication between Bristol and London there is now no need to
enter. Suffice it to say that the two cities had to wait many years
before the idea he foreshadowed was carried into effect. But I must
not omit to mention one of the arguments advanced by Mathew in
support of his general proposals, since it has a direct bearing on the
conditions of road transport at this period, and the reasons based
thereon in favour of improvements in river navigation. Thus he
urged, among other things, "the facility of Commerce from one place
to another, and the cheapness of transportation of Commodities
without so much grinding and plowing up our high-wayes, which
maketh them now in so many places impassable. You shall see," he
continued, "Western Waggons, which they call Plows, carry forty
hundred weight; insomuch as between Bristol and Marlborough they
have been enforced at a Hill they call Bagdown-hill, to put twenty
beasts, Horse and Oxen, to draw it up: This great abuse by this
means would be taken away, by keeping our high-wayes pleasant;
and withal, by this transportation of Commodities by River, the price
of Commodities would fall."

Oliver Cromwell had other matters than roads and rivers to engage
his attention, and Francis Mathew got from him no favourable
response to his proposals. But in 1670 he dedicated to Charles II.
and "the Honorable Houses of Parliament" a new edition of his
scheme under the title of "A Mediterranean Passage by Water from
London to Bristol, and from Lynne to Yarmouth, and so consequently
to the City of York for the great Advancement of Trade and
Traffique." In the course of his Dedication he said:—

"Observing by traversing this island, that divers Rivers within the


same may be moulded into such Form as will admit of Vessels of
thirty Tun burden, or upwards, to sail in, unto the great Relief of
divers Countryes in this Island, by means of the same, at less than
half the Rates now paid for Land carriage ... and considering at how
easy a Charge ... the same may be brought to pass ... I humbly
presume ... to become Importunate to your most Excellent and
Royal Majesty for the enterprize of and ready effecting this Work,
being an Undertaking so Heroick, that 'tis beyond the Level of any
others to attempt."

Among the reasons he now advanced in favour of removing the


obstructions and difficulties to be met with in the making of rivers
navigable were the "Wonderful Improvement to much Trade," and
especially the trade in coal; "the great Ease of the Subject";
increased public revenue—

"And what is well and worthy of Observing, the Highwayes hereby


will be much preserved, and become a very acceptable work to the
Country, which now notwithstanding their great cost, is a grievous
Toil as well to Man as beast, being now so unnecessarily plowed up
by Waggons of Prodigious Burthens, which in this Island are dayly
travelling."

Andrew Yarranton, who brought out in 1677 a remarkable book,


entitled "England's Improvement by Land and Sea," might be
described as a Pioneer of Protection as well as an early champion of
improved inland communication. He considered that the best way of
fighting the Dutch, who were then a source of trouble to the
country, would be, not to go to war with them, but to capture their
trade and commerce. To this end he elaborated a scheme under
which, instead of importing every year "vast quantities" of "linen
cloth of all sorts," of iron, and of woollen goods, England would
"settle" these industries here, fostering them by means of import
duties to be imposed on foreign manufactures for a period of seven
years, and supplementing those duties by the setting-up of a general
system of banking, itself, in turn, made secure by a general land
register. The linen industry, he advised, should be established in the
counties of Warwick, Leicester, Northampton, and Oxford, where,
among other considerations, navigable rivers would be available for
the purposes of transport; and he goes on to say, in words which,
though written more than two and a quarter centuries ago, seem
only to have anticipated much that we hear from the tariff reformers
of to-day, that by this means, "we should prevent at least two
millions of money a year from being sent out of the Land for Linen
Cloth, and keep our people at home who now go beyond the Seas
for want of imployment here."

In his references to the iron trade, Yarranton speaks of the "infinite


quantities of raw iron" then being made in Monmouthshire and the
Forest of Dean, and he says that the greatest part of what he calls
the "Slow Iron" made in the Forest of Dean "is sent up the Severne
to the Forges, into Worcester-shire, Shropshire, Stafford-shire,
Warwick-shire and Cheshire, and there it's made into Bar-iron: And
because of its kind and gentle nature to work, it is now at
Sturbridge, Dudly, Wolverhampton, Sedgley, Wasall, and
Burmingham and thereabouts wrought into all small Commodities
and diffused all England over, and thereby a great Trade made of it;
and when manufactured sent into most parts of the World"; though
in Worcestershire, Shropshire, Staffordshire, Warwickshire and
Derbyshire there were already great and numerous ironworks in
which, he adds, "Much Iron is made of Metal or Iron Stone of
another nature quite different from that of the Forest of Deane."

Having sketched his ideas of such reorganisation of industry as


would, in his opinion, help the country both to beat the Dutch
without fighting and, also, to provide work for all the poor people in
England, he proceeded: "That nothing may be wanting that may
conduce to the benefit and incouragement of things manufactured,
as in cheap carriage to and fro over England, and to the Sea at easie
rates, I will in the next place shew you how the great Rivers in
England may be made navigable, and thereby make the
Commodities and Goods carried, especially in Winter time, for half
the rate they now pay."
The schemes he especially recommended in this connection were for
the establishing of communication between the Thames and the
Severn, and between the Dee and the Severn; and he argued that
there would be a further advantage from the point of view of the
national food supply, as an improvement in river navigation would
allow both of corn being more easily brought to London and of the
setting up of great granaries, at Oxford for the advantage of London,
and at Stratford-on-Avon for the benefit of towns on the Severn. He
further says:—

"I hear some say, You projected the making Navigable the River
Stoure in Worcestershire; what is the reason it was not finished? I
say it was my projection, and I will tell you the reason it was not
finished. The River Stoure and some other Rivers were granted by
an Act of Parliament to certain Persons of Honour, and some
progress was made in the work; but within a small while after the
Act passed it was let fall again. But it being a brat of my own I was
not willing it should be Abortive; therefore I made offers to perfect
it, leaving a third part of the Inheritance to me and my heirs for
ever, and we came to an agreement. Upon which I fell on, and made
it compleatly navigable from Sturbridge to Kederminster; and carried
down many hundred Tuns of Coales, and laid out near one thousand
pounds, and then it was obstructed for Want of Money, which by
Contract was to be paid."

To describe, in detail, all the various schemes for the improvement of


river navigation which were carried out, more especially in the
second half of the seventeenth century and the first half of the
eighteenth (irrespective of the many others that succumbed to the
complaint spoken of by Yarranton—want of money), would take up
far too much space; but a few typical examples, which have a direct
bearing on the development of British trade, commerce and industry,
may be of interest.
Until the year 1694, when the improvement of the Mersey was taken
in hand, Liverpool had no chance of emerging from a situation of
almost complete isolation, and of competing with ports some of
which, though now ports no longer, or far outstripped by the
Liverpool of to-day, were then of vastly greater importance than
Liverpool from the point of view of national commerce.

Nature, unaided by man, had not been so considerate to Liverpool


as she had been to Bristol, to Lynn, to Hull or to Boston. These, and
other ports besides, stood on streams which were naturally
navigable for more or less considerable distances into the interior of
the country, whereas the Mersey was not naturally navigable for
more than about fifteen or twenty miles above Liverpool. The
navigation even of the estuary as far as Liverpool presented
difficulties and dangers in stormy weather, owing to sand-banks,
violent currents and rapid tides; but beyond Runcorn the Mersey was
not then navigable at all. Nor were the tributaries of the Mersey—the
Irwell and the Weaver—navigable.

Liverpool was thus shut off from communication with the interior by
river, and for a long time the town was not in a much better position
as regards roads. No Roman road came nearer to Liverpool than
Warrington, and, down to 1750 (as I have already shown), the road
between Warrington and Liverpool was not passable for coaches or
carriages. On the east Liverpool was practically isolated from the rest
of the country by the high range of hills dividing Lancashire from
Yorkshire, and there were the still more formidable hills of the Lake
District on the north. The early route for a journey to the south from
Liverpool was to cross the Mersey at Monk's Ferry, Birkenhead, and
then pass through the forest of Wirral to Chester. Here there was
found a Roman road, along which a coach to London was running in
the reign of James II. (1685-1688), whereas the first coach from
Warrington to London did not start until 1757.
So long as our commercial relations were mainly with Continental or
other ports which could be more conveniently reached from the east
or the south coast, or from Bristol, and so long as the industries of
Lancashire and Yorkshire were but little developed, or found an
outlet abroad in these other directions, the comparative isolation of
Liverpool was a matter of no great national concern; though how, in
effect, Liverpool compared with other seaports or river-ports in the
thirteenth century is shown by the fact (as told by Thomas Baines, in
his "History of the Commerce and Town of Liverpool") that whereas
the aggregate value of trading property in Liverpool, Lancaster,
Preston and Wigan—the only four towns in Lancashire which then
acknowledged possessing such property at all—was given in an
official return for the year 1343 as £233, equal to £3495 of our
present money; the equivalent value to-day of the trading property
of Bristol at the same period would be £30,000, and that of
Nottingham, then the great inland port of the Trent, £50,000.

That was a time when, as the same authority says, "Liverpool stood
nearly at the extremity of the known world." But when the known
world was enlarged by the addition thereto of the New World of
America, and when commerce with the lands across the Atlantic
began to develop, and the industries of Lancashire and Yorkshire to
grow apace, the need for improved communications with the port of
Liverpool became more and more acute.

Such need was the greater, too, because of the fate that was
overtaking the much earlier and hitherto far more prosperous port of
Chester. Established as a fortress of the first order by the Romans, at
the western end of one of their famous roads, and favoured alike by
Saxons and Normans, Chester had developed into a flourishing
commercial port from which, more especially, intercourse with
Ireland was conducted, and it was still the port through which
travellers passed to or from Ireland for a long time after Liverpool
began to compete actively for the Irish goods traffic. Richard Blome,
who visited Chester in 1673, describes it in his "Britannia" as "the
usual place for taking shipping for Ireland, with which it has a very
great intercourse, and a place of very considerable trade."

But, as against the advantage it offered as an inland port, situate


twenty-two miles from its estuary, and dealing with the products of
an especially productive county, Chester had the disadvantage due
to the enormous masses of sand which were driven into the Dee by
Atlantic storms, to the full fury and effects of which the open estuary
was exposed. This evil began to grow serious soon after the
Conquest, and the port of Chester steadily declined as the port of
Liverpool steadily rose, the trade lost by the one helping to build up
the prosperity of the other.

The benefits resulting from the improvements carried out on the


Mersey when, under the Act of 1694, navigation was extended from
Runcorn to Warrington, began to be immediately felt; but they also
brought out more clearly the great necessity for still further
amendment. How merchandise went across country in those days is
shown in a letter written in 1701 by Thomas Patten, a Liverpool
citizen who had taken a leading part in the movement that led to the
Mersey being made navigable as far inland as Warrington. Referring
to a certain consignment of tobacco which was to be despatched
from Liverpool to Hull, on behalf of a trader at Stockport, Patten
says that, as the tobacco could not be carried in the hogshead all
the way by road from Warrington to Hull, and as the sea route from
Liverpool to Hull would have taken too long, the tobacco was first
forwarded by cart, in twenty or thirty hogsheads, from the quay at
Warrington to Stockport. There it was made up into canvas-covered
parcels, and then sent on by packhorse—three parcels to a horse—a
distance of thirty-six miles by road to Doncaster, and from Doncaster
it was conveyed by river for the remainder of the distance to Hull.
Baines, who gives the letter in his "History of Lancashire and
Cheshire," remarks: "Such was the mode of conveying goods up to
that time, and for upwards of thirty years after. It is evident that
there could be no great development of trade and commerce so long
as the modes of communication were so tedious and costly."

The improvement on the Mersey itself led to a further scheme for


making the Mersey and Irwell navigable from Warrington to
Manchester, thus establishing direct water communication between
Liverpool and Manchester, as an alternative to transport by road. A
survey of the two rivers was carried out in 1712, and a prospectus
was issued in which it was said:—

"The inland parts of Lancashire and Yorkshire being favoured with a


great variety of valuable manufactures in woollen, linen, cotton, &c.,
and that in very great quantities, has made that neighbourhood as
populous, if not more so, than (London and Middlesex excepted) the
same extent of any part of Great Britain. The trades of these
counties extend considerably through the whole island, as well as
abroad, and the consumption of groceries, Irish wool, dyeing stuffs,
and other important goods consequently is very great; but as yet not
favoured with the conveniency of water carriage, though Providence,
from the port of Liverpool up to the most considerable inland town
of Lancashire, Manchester, has afforded the best, not yet employed,
rivers of Mersey and Irwell for that purpose."

It was not until the passing of the Mersey and Irwell Navigation Act,
in 1720, that the work of rendering these rivers navigable between
Warrington and Manchester was begun, and another twenty years
elapsed before it was completed. The result of this "conveniency of
water carriage" when it was, at last, obtained, was to reduce the
cost of transport of goods and merchandise from forty shillings a ton
by road to ten shillings a ton by river. The goods traffic between
Liverpool and Manchester at this time amounted to about 4000 tons
a year; but it had, prior to the provision of water transport, naturally
been restricted to the quantity that could be carried by the
packhorses, carts and waggons of those days. Hence the river
navigation gave the advantage of a transport not only cheaper in
price but greater in capacity. It will be seen later on, however, that
the Mersey and Irwell navigation subsequently developed
disadvantages for which a remedy was sought in the construction of
the Duke of Bridgewater's canal.

An Act, passed in 1720, for making the river Weaver navigable from
Winsford Bridge, beyond Northwich, to Frodsham Bridge, near the
junction of the Weaver with the Mersey (a distance of about twenty
miles), was not only of further material advantage to the port of
Liverpool but a first step in an important development of the salt
mines of Cheshire. These mines have been described as
"incomparably the richest of the salt mines and brine pits of
England"; but at the date in question their working was greatly
hampered by transport costs and difficulties in the matter both of
fuel and of the distribution of the salt, when made.

Fuel was required for heating the furnaces and the pans in which the
brine was evaporated into salt; and in the earliest days of the
industry the salt-makers used for this purpose faggots of wood
brought from the forests on the borders of Cheshire and
Staffordshire. As long as these supplies were available, the principal
seat of the salt trade was at Nantwich, in the higher part of the
Weaver, and near to the forests where the wood was obtained. But
the forests got depleted in course of time, and the industry then
moved to other works lower down the river which could be operated
with coal brought from the Lancashire coal-field. This coal, however,
had to be carried, by cart or packhorse, a distance of twelve or
fourteen miles; and inasmuch as two tons of coal were required for
every three tons of fine salt made, the cost of transport of raw
materials was a serious item.

As for the manufactured salt, that was distributed in the same way,
even such small consignments as could then alone be sent to
Liverpool having to be taken thither by road. In the circumstances
the salt trade remained comparatively undeveloped in Cheshire while
it was making great advance at Newcastle-on-Tyne, where the coal
readily obtained, by water, from the neighbouring coal-fields was
used in the production of salt from sea-water. In the time of the
Stuarts the manufacture of salt was one of the most important of
Newcastle's industries and articles of export.

When, under the Act of 1720, the Weaver was made navigable as far
as the Northwich and Winsford Bridge salt works, the land journey
for Lancashire coal was reduced from twelve or fourteen miles to
five or six miles, and the salt could be sent direct to Liverpool by
water. The greatest impetus to the Cheshire salt industry (to the
consequent detriment, and eventual extinction, of that at Newcastle-
on-Tyne, though with a further advantage to the trade of Liverpool)
was, however, not given until the makers were enabled to get their
coal all the way by water through the supplementing of the now
navigable Weaver by the Sankey Canal—of which more hereafter.

In the same year that the Act for improving the navigation of the
Weaver was passed, Parliament sanctioned a no less important work
on the river Douglas, which passes through Wigan, and has its outlet
in the Ribble estuary, at a point about nine miles west of Preston.
Wigan is situated on a part of the Lancashire coal-fields which
contains some of the richest and most valuable seams of coal to be
found in Lancashire; but down to 1720 the only means of
distributing this coal was by cart or packhorse. The opening of the
Douglas to navigation allowed of the coal being sent by water to the
estuary of the Ribble, and thence forwarded up the Ribble to
Preston, or, alternatively, along the coast either to Lancaster in the
one direction or to Liverpool and Chester in the other. These were
tedious routes, and the voyage from the Ribble estuary along the
coast was often very dangerous on account both of storms and of
sand-banks. The lines of water communication were, nevertheless,
so much cheaper than land carriage that they were followed for
about fifty years—until a safer and more expeditious waterway was
provided through the opening of the Leeds and Liverpool Canal.[22]
Thomas Baines, from whose "History of the Town and Commerce of
Liverpool" I glean these details, adds:—

"With all its defects, the Douglas navigation may be regarded as the
primary cause of the manufacturing prosperity of the town of
Preston, which it was the first means of supplying with cheap fuel
for its workshops and factories. It may, also, be considered as one of
the early causes of the commercial prosperity of Liverpool, which has
always been much promoted by the possession of cheap and
abundant supplies of coal and salt."

The rendering of the Aire and Calder navigable, under an Act of


Parliament passed in 1699, was an important event for the then
rising manufacturing towns of Leeds, Wakefield, Halifax, Bradford
and Huddersfield, situate on or within a convenient distance of one
or other of these two rivers which, joining at Castleford, ten miles
below Leeds, thence flow in a combined stream to their junction
with the Yorkshire Ouse, and so on to the Humber and the ports of
Hull and Grimsby. The event in question was no less interesting
because it marked a further development in an industrial transition
which constitutes a leading factor in the economic history of
England.

The textile industries originally established in the eastern counties by


refugees from the Netherlands and France afterwards spread
through the southern and western counties, attaining in each district
to a very considerable growth long before they were of any
importance in those northern counties with which they were
afterwards mainly to be associated. The migration to the north
occurred at a time when the woollen industries were paramount and
the cotton industries had still to attain their subsequent stupendous
growth. It occurred, also, long before the Aire and the Calder were
made navigable, so that, in this case, we cannot say the industrial
centres already mentioned as being situated on or near to those two
Yorkshire rivers were set up there, as the towns on the river Severn
had mainly been, in order to secure the convenience of river
transport.

The chief reason why the bleak and barren moorlands of the north
were preferred to the fair and fertile plains of the south for the
further expansion of these great national industries was that, in the
days when the steam-engine of James Watt was as yet far off, the
heavier rainfall in the English Highlands of the north and north-west,
together with the more numerous streams pouring down mountain
sides both of greater height and of greater extent than in the south,
gave to the cloth-makers, not only the abundant water supply they
wanted, but, also, the particular kind of motive power, through the
use of water-wheels, on which they then mainly relied for the
working of their machinery.

It was in the interests of this power derived from falling water that
the textile industries first migrated from the eastern counties—where
the streams flow but slowly, and from comparatively slight elevations
—to the western counties, where there are streams coming from
hills of from 800 to 1000 feet in height. These, for a time, answered
better the desired purpose, though only to be more or less
discarded, in turn, for northern or north-western streams which, with
a greater rainfall, had their rise on heights of from 1500 to 2000
feet, and were so numerous that almost every one of the "small"
manufacturers who set up business for himself on the otherwise
cheerless slope of a Yorkshire hill-side could have a brook, a rivulet,
or a mountain torrent of his own, or, at least, make abundant use of
one before it passed on to serve the purposes of his neighbour.

In alluding to the woollen trade as affected by these conditions, Dr


Aikin remarks in his "Description of the Country from Thirty to Forty
Miles round Manchester" (1795), "It would seem as if a hilly country
was particularly adapted to it, since it almost ceases where Yorkshire
descends into the plain"; though the position has, of course, been
entirely changed by the general resort to steam in preference to
water power.

Other industries, besides those relating to textiles, whether woollen


or, at a later period, cotton, took advantage of the same favourable
conditions, as shown in the case of Sheffield, where the earliest of
the cutlers who were to make Hallamshire goods famous throughout
the world settled down at the confluence of the Sheaf and the Don
because those streams afforded them the best available means of
operating their tilt-hammers.[23]

In the early stage of this transition period the streams were desired
and utilised solely as an aid to manufacturing purposes. As the
towns or the industrial centres developed, however, there grew up
increasing need for improved means of transport—supplementary to
the roads of that day—in order, more especially, to facilitate the
better distribution of the commodities then being produced in ever-
increasing quantities. It was this need that led to the Act of 1699,
giving powers for rendering the Aire and the Calder navigable.
Petitions in favour thereof were presented by the "clothiers" (as
cloth-makers were then called) of various towns likely to derive
advantage from the scheme, and some of these petitions afford an
interesting insight into the conditions under which the cloth industry
was carried on in Yorkshire and Lancashire in the closing years of
the seventeenth century.

A petition from the "clothiers" of Leeds said, "That Leeds and


Wakefield are the principal towns in the north for cloth; that they are
situated on the rivers Ayre and Calder, which have been viewed, and
are found capable to be made highways which, if effected, will very
much redound to the preservation of the highways and a great
improvement of trade; the petitioners having no conveniency of
water carriage within sixteen miles of them, which not only
occasions a great expense, but many times great damage to their
goods, and sometimes the roads are not passable."

The clothiers of "Ratchdale" (Rochdale) stated that they were "forty


miles from any water carriage"; those of Halifax said they "have no
water carriage within thirty miles, and much damage happens
through the badness of the roads by the overturning of carriages";
and those of Wakefield said of the scheme:—

"It will be a great improvement of trade to all the trading towns of


the north by reason of the conveniency of water carriage, for want
of which the petitioners send their goods twenty-two miles by land
carriage (to Rawcliffe) the expense whereof is not only very
chargeable but they are forced to stay two months sometimes while
the roads are impassable to market, and many times the goods
receive considerable damage, through the badness of the roads by
overturning."

The general conditions of life in Yorkshire towns in Defoe's day,


when the Aire and Calder had been made navigable, but when bad
roads still dominated the situation from a social and domestic
standpoint, are shown in the account he gives of his visit to Halifax.
After explaining how the people devoted themselves mainly to cloth
production and imported most of their household requirements, he
says:—

"Their Corn comes up in great quantities out of Lincoln, Nottingham


and the East Riding; their Black Cattle and the Horses from the
North Riding, their Sheep and Mutton from the adjacent Counties
every way, their Butter from the East and North Riding, their Cheese
out of Cheshire and Warwickshire, more Black Cattle also from
Lancashire. And here the Breeders and Feeders, the Farmers and
Country People find Money flowing in plenty from the Manufactures
and Commerce; so that at Halifax, Leeds and the other great
manufacturing Towns, and adjacent to these, for the two months of
September and October a prodigious Quantity of Black Cattle is sold.

"This Demand for Beef is occasioned thus: the usage of the People is
to buy in at that Season Beef sufficient for the whole Year which
they kill and salt, and hang up in the Smoke to dry. This way of
curing their Beef keeps it all the Winter, and they eat this smoak'd
Beef as a very great Rarity.

"Upon this foot 'tis ordinary for a Clothier that has a large Family, to
come to Halifax on a Market Day, and buy two or three large
Bullocks from eight to ten Pounds a-piece. These he carries home
and kills for his Store. And this is the reason that the markets at all
those times of the Year are thronged with Black Cattle, as Smithfield
is on a Friday, whereas all the rest of the year there is little
extraordinary sold there."

We have here full confirmation of what I have already said as to the


way in which people in former days provisioned their houses in the
autumn for the winter months, during which the roads would be
impassable and food supplies from outside unobtainable.

The trading conditions of the period are shown by the accounts of


the once-famous cloth market of Leeds given, in his "Ducatus
Leodiensis; or the Topography of Leedes," by Ralph Thoresby
(1715), and, also, in his "Tour," by the ever-picturesque Defoe.

Thoresby, who speaks of "the cloathing trade" as being "now the


very life of these parts," tells us that the Leeds cloth-market was
held on the bridge over the Aire every Tuesday and Saturday down
to June 14, 1684, when, for greater convenience, it was removed to
Briggate, the "spacious street" leading from the bridge into the
town. Already, in Thoresby's day, Leeds was the manufacturing
capital of the district, and he speaks of its cloth-market as "the life
not of the town only but of these parts of England."

Defoe, in his account of the market, describes it as "indeed a


Prodigy of its kind, and not to be equalled in the world." He tells
how, making their way to Leeds at an early hour in the morning
from the surrounding district, the "clothiers," each bringing, as a
rule, only a single piece of cloth, assembled at the various inns, and
there remained until the ringing of a bell, at seven o'clock in the
summer, or a little later in the winter, announced that trestles, with
boards across them for the display of the cloth, had been duly fixed
in the roadway, and that the market had opened. Thereupon the
clothiers, without rush or haste, and in the most solemn fashion,
would leave their inns, and step across the footpath to the "stalls" in
the roadway. Standing quite close to one another, they then put
down their cloth on the boards, which would soon be completely
covered with rolls of cloth arranged side by side. While the clothiers
were so engaged, the merchants would have left their houses,
entered the market, and begun their inspection of the goods
displayed for sale, so that within fifteen minutes of the ringing of the
bell the market would be in full operation. When a merchant saw a
piece of cloth which suited his requirements he would lean across
the boards, and whisper in the ear of the clothier the price he was
prepared to give, this practice of whispering being adopted in order
that the other clothiers standing immediately alongside should not
hear what was said. The clothier agreed or disagreed, without any
attempt at "bargaining." If satisfied with the offer, he would instantly
pick up the cloth, and go off with it to the merchant's house, where
the transaction would be completed. Within less than half an hour
the clothiers would be seen thus leaving the market; in an hour the
business would be over, and at half-past eight the bell would be rung
again, to announce that the market had closed and that there must
be no more sales. Any clothier who had not sold his cloth would then
take it back with him to his inn.
"Thus," says Defoe, "you see Ten or Twenty thousand Pounds value
in cloth, and sometimes much more, bought and sold in little more
than an hour.... And that which is most admirable is 'tis all managed
with the most profound Silence, and you cannot hear a word spoken
in the whole Market, I mean by the Persons buying and selling; 'tis
all done in whisper.... By nine a Clock the Boards are taken down,
and the street cleared, so that you see no market or Goods any
more than if there had been nothing to do; and this is done twice a
week. By this quick Return the Clothiers are constantly supplied with
Money, their Workmen are duly paid, and a prodigious Sum
circulates thro' the Country every week."

It is no less interesting—and, also, no less material to the present


inquiry as to the influence of transport conditions on trade—to learn
how the cloth purchased in these particular circumstances was
disposed of in days when travel through the country was still
attended by so many difficulties.

The supplies intended for home use were distributed in this manner:
Leeds was the head-quarters of a body of merchants who were in
the habit of going all over England with droves of packhorses loaded
up with the cloth which had been bought in the open-air market, as
already described. These travelling merchants did not sell to
householders, since that would have constituted them pedlars. They
kept to the wholesale business, dealing only with shopkeepers in the
towns or with traders at the fairs; but they operated on such a scale
that, Defoe says, "'tis ordinary for one of these men to carry a
thousand pounds value of Cloth with them at a time, and having sold
it at the Fairs or Towns where they go, they send their Horses back
for as much more, and this very often in the Summer, for they chuse
to travel in the summer, and perhaps towards the Winter time, tho'
as little in Winter as they can, because of the badness of the Roads."
Other of the buyers on the Leeds market sent their purchases to
London, either carrying out commissions from London traders or
forwarding on consignment to factors and warehousemen who
themselves supplied wholesale and retail dealers in London, besides
despatching great quantities of coarse goods abroad, especially to
New England, New York, Virginia, etc. The Russian merchants in
London also sent "an exceeding quantity" to St Petersburg, Riga,
Sweden, Dantzic and Pomerania.

Still another group of buyers was represented by those who had


commissions direct from traders in Holland, Germany and Austria,
the business done by the members of this group being "not less
considerable" than that done by the others.

It was mainly on account of this London and foreign trade that the
Act for making the rivers Aire and Calder navigable was obtained,
there being secured a waterway communication by means of which
the cloth could be sent direct from Leeds, Wakefield and other
industrial centres to Hull, there to be shipped to London or to
Continental ports, as desired.

The facilities for navigation thus afforded subsequently had a still


greater influence on the development of the Yorkshire coal trade,
coal being taken from Wakefield or Leeds to the Humber, and thence
conveyed up the Ouse to York, or to the numerous towns situate on
the Trent or other rivers. By the same navigation the Yorkshire towns
received most of their supplies, either as imported into Hull from
abroad, or as received there from London or the eastern counties,
these supplies including butter, cheese, salt, sugar, tobacco, fruit,
spices, oil, wine, brandy, hops, lead, and all kinds of heavy or bulky
goods. For the merchants of Hull this meant a business to be
compared only with that of the merchants of Lynn and Bristol.
Some of the many river improvement Acts passed in the period here
under review were not secured without a certain amount of
opposition, and the case of the Don, more especially, offers a
striking example of that conflict of rival interests, even in the case of
rivers, which later on was to give rise to many a Parliamentary battle
in the days, first of canals, and then of railways.

How the cutlers of Sheffield and the steel manufacturers and others
of Hallamshire in general had been accustomed to forward their
goods by road to the inland port of Bawtry, thence to be sent down
the Idle and on by the Trent and the Humber to Hull, has already
been told. (See pp. 123-4.) There came a time, however, when this
preliminary land journey of twenty miles from Sheffield to Bawtry
was found of great disadvantage to the trade of the district; and in
1697 leave was given to bring in a Bill to allow of the Don, already
navigable to Doncaster, being rendered navigable to Sheffield, in
order that merchandise might be sent by that stream direct from
Sheffield to the Ouse, and so on to the Humber and the port of Hull.
But the opposition offered by representatives of the Bawtry, Trent
and other interests—who rightly foresaw in the scheme impending
ruin for most of the traffic on the Idle—was so powerful that the Bill
was thrown out. A further Bill, with a like object, was introduced,
and strongly supported, in the following Session. It was still more
vigorously opposed, there being what Hunter describes as "a war of
petitions," and it was not proceeded with.

For a time nothing further was done; but in the meanwhile Sheffield
was rapidly advancing to the position of one of the leading industrial
centres in the country, and the compulsory twenty-mile journey by
road to the chief port of consignment for Sheffield goods sent to
London or abroad when there was a river flowing through Sheffield
itself, was felt to be an intolerable infliction, as well as a serious
prejudice to the local industries.
In 1722, therefore—twenty-four years after the last of the earlier
attempts—the Master Cutler of Sheffield and the Cutlers' Company
petitioned Parliament to allow the improvement of the Don
navigation to proceed. The corporation of Doncaster sent a like
petition, and so did the corporations of Manchester, Stockport and
several other places. But the established interests still controlled the
situation, and the design once more failed.

Four years later (1726) the Sheffield cutlers made still another effort,
and this time, although the opposition was again very powerful, it
was agreed in Committee of the House of Commons that power
should be given to the Cutlers' Company to make the Don navigable
from Doncaster, not to Sheffield itself, but to Tinsley, three miles
from Sheffield; and, also, to maintain a turnpike road from Sheffield
to Tinsley. A Bill to this effect was passed, and in 1727 the
corporation of Doncaster obtained powers to remove certain
obstructions from the Don; but, under an Act of 1732, the carrying
out of the whole scheme was transferred to an independent body,
the Company of Proprietors of the River Don Navigation. It proved,
says Hunter, writing in 1828, "eminently beneficial to the country";
but the reader will see that the Sheffield cutler or manufacturer still
had to forward his goods three miles by road before they could be
sent, first along the Don, then along the Ouse, then down the
Humber to Hull, and then (if they were consigned to London) by sea
along the east coast, and finally up the Thames to the Metropolis.
These were the conditions until the year 1821, when the three-mile
journey by road was saved by the opening of a canal between
Sheffield and the Don at Tinsley, affording, as was said, "easy
accommodation with the coast and London."
CHAPTER XV

DISADVANTAGES OF RIVER NAVIGATION

It will have been assumed, from the two preceding chapters, that
rivers, whether naturally navigable or rendered navigable by art,
were of material service in supplementing defective roads, in
opening up to communication parts of the country that would then
otherwise have remained isolated, and in aiding the development of
some of the greatest of our national industries.

While this assumption is well founded, yet, as time went on, the
unsatisfactory nature of much of the inland river navigation in this
country became more apparent.

Some of the greatest troubles arose from, on the one hand, excess
of water in the rivers owing to floods, and, on the other, from
inadequate supplies of water due either to droughts or to shallows.

The liability to floods will be at once apparent if the reader considers


the extent of the areas from which rain water and the yield of
countless springs, brooks, and rivulets may flow into the principal
rivers. In the Report of the Select Committee of the House of Lords
on Conservancy Boards, 1877, there was published a list which
showed that the 210 rivers in England and Wales had catchment
basins as follows:—

1000 miles and upwards 11


500 " to 1000 miles 14
100 " " 500 " 59
50 " " 100 " 24
10 " " 50 " 102
——
Total 210

The rivers having catchment basins of 1000 miles or upwards are


given thus:—

Area of Tributaries.
Basin. United
Name. County.
Length. sq. length.
Miles. miles. No. miles.
Humber York 37 1229 2 55
Mersey Lancaster 68 1707 6 188
Nen Northampton 99 1055 1 11
Ouse York 59½ 4207 11 629
Ouse Cambridge 156¼ 2894 8 212
Severn Gloucester 178 4437 17 450
Thames — 201¼ 5162 15 463

Trent Lincoln 167½ 3543 10 293


Tyne Northumberland 35 1053 6 154

Witham Lincoln 89 1052 4 75


Wye Hereford 148 1655 9 223

In times of heavy storms or of continuous rainy weather, rivers


which drain up to 5000 square miles of country may well experience
floods involving a serious impediment to navigation.

The Severn, which brings down to the Bristol Channel so much of


the water that falls on Plinlimmon and other Welsh hills, and is
joined by various streams, draining, altogether, as shown above, an
area of 4437 square miles, is especially liable to floods. In a paper
read before the Institution of Civil Engineers in 1860, Mr. E. L.
Williams stated that floods had been known to raise the height of
the Severn 18 ft. in five hours, and they had not infrequently caused
it to attain a height of 25 ft. above the level of low water. The
Thames and the Trent, also, are particularly liable to floods, and so,
down to recent years, when considerable sums were spent on its
improvement, was the Weaver.

It has been asserted in various quarters that less water runs in


English rivers now than was probably the case centuries ago, when
the abundant forests caused a greater rainfall. This may be so, but,
on the other hand, a number of witnesses examined before the
Select Committee of 1877 expressed the belief that the water
flowing into the rivers had increased of recent years, owing to the
improved land drainage, which drained off rapidly and sent down to
the sea much rain water that previously would have passed into the
air again by evaporation.

In the matter of high tides, "Rees' Cyclopædia" (1819) says that the
tide "often" rises at the mouth of the Wye to a height of 40 ft.; while
"Chambers' Encyclopædia" gives 47 ft. above low-water mark as the
height to which the tide has been known to rise in the same river at
Chepstow.

Of the floods in the Yorkshire Ouse Rodolph De Salis says in


"Bradshaw's Canals and Navigable Rivers of England" (1904): "The
non-tidal portion of the river above Naburn Locks is liable to floods,
which at York often reach a height of 12 ft., and have been known to
attain a height of 16 ft. 6 in. above summer level."

The liability of English rivers to a shortage of water would seem to


be as great as their liability to excess of it. In Archdeacon Plymley's
"General View of the Agriculture of Shropshire" (1803) there is
published a table, compiled by Telford, giving the heights reached by
the Severn between 1789 and 1800. It shows that, as against some
very serious floods and inundations, the river often, during the dates
mentioned, ran for considerable periods with a stream of no more
than sixteen inches of water; that it frequently had less than a foot
of water; and that in times of extreme drought the depth of water
had been reduced to nine inches. In 1796, the period during which
barges could be navigated even down-stream with a paying load did
not exceed two months, and "this interruption," it is stated, "was
severely felt by the coal-masters, the manufacturers of iron, and the
county in general."

The navigation of the Trent is declared in "Rees' Cyclopædia" to be


"of vast importance to the country"; yet the authority of John
Smeaton, who had examined the river in 1761, is given for the
statement that in several places the ordinary depth of water did not
exceed eight inches. In the upper part of the river there were, in
1765, more than twenty shallows over which boats could not pass in
dry weather without flushes of water.

The inadequate depth of water may be due, not alone to drought,


but to the formation of shoals or shallows owing to the rapid fall of
the river, its excessive width, or the amount of sediment brought
down from the hill-sides or washed from the bed over which it flows.
Alternatively, much silting-up may be caused by the sand brought
into the river by incoming tides, and not always washed out again by
out-going tides.

In an undated pamphlet, entitled "Reflections on the General Utility


of Inland Navigation to the Commercial and Landed Interests of
England, with Observations on the Intended Canal from Birmingham
to Worcester," by the proprietors of the Staffordshire Canal, stress is
laid on the trouble caused by the shoals in the Severn, and some
facts are given as to the way in which traders had to meet the
uncertainties offered by river transport. The pamphlet says:—

"A principal defect of the present conveyance arises from the shoals
in the river Severn above Worcester, an evil incurable. The fall from
Stourport to Diglis, near Worcester, is nineteen feet; and the river is,
what this fact alone would prove, full of shoals. These shoals impede
the current of the stream, and retain the water longer in the bed of
the river. Let these shoals be removed, the water will pass off, and
the whole of the river become too shallow for navigation. Locks on
the river could alone correct this defect; but these would overflow
the meadows, impede the drainage of the land, and do an injury to
the landowners, which parliament can never sanction.

"This defect gives rise to others—to uncertainty as to the time of the


conveyance—for it is only at particular periods that there is water
sufficient for the navigation—to delays from a want of men[24] and
expence from the increased number which the strong current
requires. It gives rise, also, to a double transhipping of commodities
sent from Birmingham down the Severn, first from the canal at
Stourport, and secondly at or near Worcester, as the barges which
this shoal water will admit are too small to navigate much below.

"The delays and damage incidental to such a navigation have


induced the manufacturers of Birmingham to employ land carriage at
a great expence—many waggons are constantly employed at the
heavy charge of 4l. per ton from Birmingham to Bristol alone to
convey goods or manufactures which cannot await the delay or
damage to which in the present navigation they are necessarily
exposed;—large quantities of manufactures and the materials of
manufactures are likewise sent to Diglis to be conveyed by the
Severn in vessels that cannot navigate higher up the river."

In the Trent frequent shallowness of water was due, partly to the


excessive breadth of the stream, in places, and partly to the large
quantity of "warp," or silt, brought into the river from the Humber
estuary by the tides, and left there until scoured out again when the
river was in flood.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like