Skip to content

okindev/napi-svn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

napi-svn

npm size license downloads

A napi module that wraps subversion

Supported platforms

OS Architecture Supported
Windows x64 Yes
Windows x86 No
Windows arm No
Linux x64 No
Linux arm No
MacOS N/A No

Features

  • SVN 1.10.2
  • Authentication
  • HTTP/HTTPS support
  • Error handling
  • NAPI
  • No external dependencies

Installation

npm install napi-svn 

Usage

List files in repo

results = svn.ls(URL, options);
results.forEach(element => {
    console.log(element);
});

Display log history of repositiory

const options = {
    username: "user",
    password: "password",
    autoconnect: true,
    verbose: false
};

const revision = {
    URI: [URL],
    revision_range: {
        start: {
            kind: svn.svn_opt_revision_number,
            value: 0
        },
        end: {
            kind: svn.svn_opt_revision_head,
        }
    }
};

svn.log(revision, (log) => {
    console.log(log);
}, options);

Display content of a file

const options = {
    username: "user",
    password: "password",
    autoconnect: true,
    verbose: false
};

console.log(svn.cat(urljoin(URL, "LICENSE"), options));

Checkout repository

const options = {
    username: "user",
    password: "password",
    autoconnect: true,
    verbose: false
};

svn.checkout(URL, path, (action) => {
    console.log(action);
}, options);

Upgrade repository

const options = {
    username: "user",
    password: "password",
    autoconnect: true,
    verbose: false
};

svn.upgrade(path, options);

Export repository

const options = {
    username: "user",
    password: "password",
    autoconnect: true,
    verbose: false
};

svn.export(URL, path, (action) => {
    console.log(action);
}, options);

API

ls(url[, options])

  • url A string representing the URL for listing
  • options Options authentication settings.
  • Returns: Array of directory entries

List directory entries in the repository

log(revision, callback[, options])

  • revision Revision revision settings.
  • callback Callback function with the method notification event.
  • options Options authentication settings.
  • Returns: Undefined

cat(url[, options])]

  • url A string representing the URL with the file path in the repository.
  • options Options authentication settings.
  • Returns: String with the contents of the file.

checkout(url, path, callback[, options])]

  • url A string representing the URL for the repository.
  • path A string representing the local checkout path.
  • callback Callback method with the method notification event.
  • options Options authentication settings.
  • Returns: Undefined

upgrade(path[, options])]

  • path A string representing the local repository path.
  • options Options authentication settings.
  • Returns: Undefined

export(path, callback[, options])]

  • path A string representing the local repository path.
  • callback Callback method with the method notification event.
  • options Options authentication settings.
  • Returns: Undefined

Options

Repository authentication object

{
    // These properties are the the standard svn command
    username: "user",      // login username 
    password: "password",  // login password
    autoconnect: false,    // auto accept certifcate 
    verbose: false // verbose logging setting
}

Revision

Revision range object for the log command

{
    URI: [URL],
    revision_range: {
        start: {
            kind: svn.svn_opt_revision_number,
            value: 0
        },
        end: {
            kind: svn.svn_opt_revision_head,
        }
    }
}

License

MIT

About

nodejs napi library for svn

Resources

License

Stars

Watchers

Forks

Packages

No packages published