add more package maintenance features

This commit is contained in:
Grahame Grieve 2020-01-31 08:19:51 +11:00
parent 1831d19541
commit 5d1cf89db5
1 changed files with 18 additions and 0 deletions

View File

@ -756,5 +756,23 @@ public class NpmPackage {
Collections.sort(res);
return res ;
}
public void clearFolder(String folderName) {
NpmPackageFolder folder = folders.get(folderName);
folder.content.clear();
folder.types.clear();
}
public void deleteFolder(String folderName) {
folders.remove(folderName);
}
public void addFile(String folderName, String name, byte[] cnt, String type) {
NpmPackageFolder folder = folders.get(folderName);
folder.content.put(name, cnt);
if (!folder.types.containsKey(type))
folder.types.put(type, new ArrayList<>());
folder.types.get(type).add(name);
}
}