more support for .index.db

This commit is contained in:
Grahame Grieve 2023-09-18 17:07:19 +10:00
parent fa2168fc56
commit 5151fa39de
2 changed files with 13 additions and 13 deletions

View File

@ -223,13 +223,13 @@ public class NpmPackage {
List<String> res = new ArrayList<>();
if (folder != null) {
for (File f : folder.listFiles()) {
if (!f.isDirectory() && !Utilities.existsInList(f.getName(), "package.json", ".index.json")) {
if (!f.isDirectory() && !Utilities.existsInList(f.getName(), "package.json", ".index.json", ".index.db")) {
res.add(f.getName());
}
}
} else {
for (String s : content.keySet()) {
if (!Utilities.existsInList(s, "package.json", ".index.json")) {
if (!Utilities.existsInList(s, "package.json", ".index.json", ".index.db")) {
res.add(s);
}
}
@ -1095,12 +1095,12 @@ public class NpmPackage {
public void save(OutputStream stream) throws IOException {
assert !minimalMemory;
TarArchiveOutputStream tar;
ByteArrayOutputStream OutputStream;
BufferedOutputStream bufferedOutputStream;
// ByteArrayOutputStream OutputStream;
// BufferedOutputStream bufferedOutputStream;
GzipCompressorOutputStream gzipOutputStream;
OutputStream = new ByteArrayOutputStream();
bufferedOutputStream = new BufferedOutputStream(OutputStream);
// OutputStream = new ByteArrayOutputStream();
// bufferedOutputStream = new BufferedOutputStream(OutputStream);
GzipParameters gp = new GzipParameters();
gp.setCompressionLevel(Deflater.BEST_COMPRESSION);
gzipOutputStream = new GzipCompressorOutputStream(stream, gp);
@ -1122,7 +1122,7 @@ public class NpmPackage {
System.out.println(name+" is null");
} else {
indexer.seeFile(s, b);
if (!s.equals(".index.json") && !s.equals("package.json")) {
if (!s.equals(".index.json") && !s.equals(".index.db") && !s.equals("package.json")) {
TarArchiveEntry entry = new TarArchiveEntry(name);
entry.setSize(b.length);
tar.putArchiveEntry(entry);
@ -1158,10 +1158,10 @@ public class NpmPackage {
tar.finish();
tar.close();
gzipOutputStream.close();
bufferedOutputStream.close();
OutputStream.close();
byte[] b = OutputStream.toByteArray();
stream.write(b);
// bufferedOutputStream.close();
// OutputStream.close();
// byte[] b = OutputStream.toByteArray();
// stream.write(b);
}
/**

View File

@ -45,7 +45,7 @@ public class NpmPackageIndexBuilder {
new File(filename).delete();
conn = DriverManager.getConnection("jdbc:sqlite:"+filename);
Statement stmt = conn.createStatement();
stmt.execute("CREATE TABLE index (\r\n"+
stmt.execute("CREATE TABLE ResourceList (\r\n"+
"FileName nvarchar NOT NULL,\r\n"+
"ResourceType nvarchar NOT NULL,\r\n"+
"Id nvarchar NULL,\r\n"+
@ -57,7 +57,7 @@ public class NpmPackageIndexBuilder {
"Content nvarchar NULL,\r\n"+
"PRIMARY KEY (FileName))\r\n");
psql = conn.prepareStatement("Insert into index (FileName, ResourceType, Id, Url, Version, Kind, Type, Supplements, Content) values (?, ?, ?, ?, ?, ?, ?, ?, ?)");
psql = conn.prepareStatement("Insert into ResourceList (FileName, ResourceType, Id, Url, Version, Kind, Type, Supplements, Content) values (?, ?, ?, ?, ?, ?, ?, ?, ?)");
} catch (Exception e) {
conn = null;
}