node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org Ā»



copy a template directory with variables injected

implemented using pull streams for every async operation, so is very fast and usess minimal memory. šŸ‡

npmĀ installĀ --saveĀ fs-template


template = require('fs-template')

template(options, (err) => {})

options is an object of the following:

  • source: required source directory path
  • target: required target directory path
  • vars: object of variables to inject into templates (default: {})
  • cwd: current working directory to resolve relative file paths (default: process.cwd())
  • open: string to denote opening of variable injection (default: "{{")
  • close: string to denote closing of variable injection (default: "}}")
  • parallel: how many async operations to run in parallel (default: 10)

callback is called when operation is done, either complete or has errored.


The Apache License

Copyright Ā© 2017 Michael Williams

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.