1.0.4 • Published 5 years ago

napi-svn v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

napi-svn

npm size license downloads

A napi module that wraps subversion

Supported platforms

OSArchitectureSupported
Windowsx64Yes
Windowsx86No
WindowsarmNo
Linuxx64No
LinuxarmNo
MacOSN/ANo

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

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago