Giter VIP home page Giter VIP logo

node-api's Introduction

General Assembly Logo

Introduction to the Node API

Prerequisites

  • Familiarity with JavaScript as a language.
  • Familiarity with JavaScript in the browser environment.

Objectives

By the end of this, developers should be able to:

  • Reference the Node API documentation for using JavaScript outside the browser.
  • Reference the MDN JavaScript documentation for JavaScript language features.
  • Write a Node script using the File System API.

Preparation

  1. Fork and clone this repository.
  2. Install dependencies with npm install.

JavaScript, the Browser, and Node

  • JavaScript: a language specified by ECMA and implemented independently
  • Browser: an environment for running JavaScript (among other things)
  • Node: an environment for running JavaScript outside the browser

Somewhat valid equations:

Browser = JavaScript + Browser API + (other things)
   Node = JavaScript + CLI/Server API

How are the two environments similar? How do they differ?

Lab: Research the File System API

Take a few minutes to read the following API documentation for the Node File System module.

While you're reading, imagine how you'd use each function. Write some example code in your notebook. Try to explain what each function does in your own words, including what sorts of arguments it takes and each argument's type.

If you finish early, look for other interesting functions in the File System module.

  1. fs.readdir(path, callback)
  2. fs.readdirSync(path)
  3. fs.readFile(file[, options], callback)
  4. fs.writeFile(file, data[, options], callback)

Annotate-Along: lib/copy-json.js

Code-Along: hey-yall.js

"Hello, World!" with the Node file system API.

Lab: Write a Randomizer

Randomize the lines in a file.

How do you shuffle an array?

Additional Resources

  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

node-api's People

Contributors

payne-chris-r avatar jrhorn424 avatar raq929 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.