Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Node Cookbook

You're reading from   Node Cookbook Discover solutions, techniques, and best practices for server-side web development with Node.js 14

Arrow left icon
Product type Paperback
Published in Nov 2020
Publisher Packt
ISBN-13 9781838558758
Length 512 pages
Edition 4th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Bethany Griggs Bethany Griggs
Author Profile Icon Bethany Griggs
Bethany Griggs
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Chapter 1: Introducing Node.js 14 2. Chapter 2: Handling I/O FREE CHAPTER 3. Chapter 3: Streams, Streams, Streams 4. Chapter 4: Using Web Protocols 5. Chapter 5: Developing Node.js modules 6. Chapter 6: Exploring Node.js web Frameworks 7. Chapter 7: Working with Databases 8. Chapter 8: Testing with Node.js 9. Chapter 9: Securing Node.js Applications 10. Chapter 10: Performance Optimization 11. Chapter 11: Deploying Node.js Microservices 12. Chapter 12: Debugging Node.js 13. Other Books You May Enjoy

Persisting data with LevelDB

LevelDB is an embedded database. It is a key-value store written by Google, where the data is sorted by key. LevelDB is commonly used in cases where fast access to large datasets is required. LevelDB is used directly as a library, so there is no server or command-line interface.

In this recipe, we're going to implement a task list using LevelDB as our store.

Getting ready

  1. To get started, create a directory named leveldb-app containing a file named tasks.js:
    $ mkdir leveldb-app
    $ cd leveldb-app
    $ touch tasks.js
  2. LevelDB is a library that we will install from the npm registry, so we'll need to initialize our project:
    $ npm init --yes 

Now that we've initialized our project, we can move on to the recipe.

How to do it…

In this recipe, we'll be using the levelup and leveldown modules to create and interact with our LevelDB store:

  1. The first step is to install the levelup and leveldown modules from...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime