1.0.4 • Published 7 years ago
napi-svn v1.0.4
napi-svn
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)
urlA string representing the URL for listingoptionsOptions authentication settings.- Returns: Array of directory entries
List directory entries in the repository
log(revision, callback, options)
revisionRevision revision settings.callbackCallback function with the method notification event.optionsOptions authentication settings.- Returns: Undefined
cat(url, options)]
urlA string representing the URL with the file path in the repository.optionsOptions authentication settings.- Returns: String with the contents of the file.
checkout(url, path, callback, options)]
urlA string representing the URL for the repository.pathA string representing the local checkout path.callbackCallback method with the method notification event.optionsOptions authentication settings.- Returns: Undefined
upgrade(path, options)]
pathA string representing the local repository path.optionsOptions authentication settings.- Returns: Undefined
export(path, callback, options)]
pathA string representing the local repository path.callbackCallback method with the method notification event.optionsOptions 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