mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-31 15:19:42 +02:00
Remove archiver dependency
This commit is contained in:
parent
415e0a7b5a
commit
ab08d83c04
35 changed files with 4046 additions and 194 deletions
21
server/libs/archiver/normalize-path/LICENSE
Normal file
21
server/libs/archiver/normalize-path/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2018, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
35
server/libs/archiver/normalize-path/index.js
Normal file
35
server/libs/archiver/normalize-path/index.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*!
|
||||
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
||||
*
|
||||
* Copyright (c) 2014-2018, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
module.exports = function (path, stripTrailing) {
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('expected path to be a string');
|
||||
}
|
||||
|
||||
if (path === '\\' || path === '/') return '/';
|
||||
|
||||
var len = path.length;
|
||||
if (len <= 1) return path;
|
||||
|
||||
// ensure that win32 namespaces has two leading slashes, so that the path is
|
||||
// handled properly by the win32 version of path.parse() after being normalized
|
||||
// https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
|
||||
var prefix = '';
|
||||
if (len > 4 && path[3] === '\\') {
|
||||
var ch = path[2];
|
||||
if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
|
||||
path = path.slice(2);
|
||||
prefix = '//';
|
||||
}
|
||||
}
|
||||
|
||||
var segs = path.split(/[/\\]+/);
|
||||
if (stripTrailing !== false && segs[segs.length - 1] === '') {
|
||||
segs.pop();
|
||||
}
|
||||
return prefix + segs.join('/');
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue