node package manager


NodeJS wrapper for TFS command line tool.


NodeJS wrapper for TFS command line tool.

If you're a NodeJS developer whishing to use it as a dependency, there is a module exposing all commands and described in the NodeJS API.

npm install -g tfs
Usage: tfs <cmd>
add [itemspec] [options]       Adds files and folders to version control.
checkin [itemspec] [options]   Commits pending changes in the current workspace.
checkout [itemspec] [options]  Makes the local file writable, and changes its status to "edit".
get [itemspec] [options]       Get the latest version of files and folders.
history [itemspec] [options]   Displays the revision history for one or more files, folders or both.
info [itemspec] [options]      Displays information about items under version control.
status [itemspec] [options]    Displays information about pending changes.
undo <itemspec> [options]      Removes pending changes from a workspace.
help [cmd]                     Displays help for [cmd].

Since tfs is a wrapper, it only check and execute commands via TF.exe command line tool. So to know how to use each command, just check the Tf Command-Line Utility Commands official documentation.

Also don't hesitate to use the help command, i.e. :

tfs [cmd] -h, --help

Or :

tfs help [cmd]
  -h, --help  output usage information

For [itemspec] commands :

  • If you omit [itemspec], it will apply on the current directory.
  • You can use a relative, an absolute or a TFS path.
  • You can give multiple files/directories separated by a space.

You can install tfs as a dependency for your NodeJS projects :

npm install tfs --save

Some commands, like status, have extra-properties in their response.
To get real-life examples of common commands, check this Github directory.

To recursively get the status (pending changes) of files within D:\MyBranch\MyProject, admitting that this project is source-versionned via TFS, you could write the following code :

var tfs = require('tfs');

var callback = function(responseError, response) {
  if (responseError) {


tfs('status', 'D:/MyProject/MyBranch', {
  recursive: true
}, callback);
tfs(command, [items, [options, [callback]]]);
{String} TFS command to execute.
{Array} File(s) or changeset number.
        Can be null/undefined to use the current path.
{Object} TFS command options. Can be null/undefined.
{Function} Function to call back once command executed.
           Will be called back with 2 arguments: error, response.

           error: {
             error:   {String},
             isError: true

           response: {
             message: {String},
             isError: false