ain't no thing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
John SJ Anderson 79571ed6fb Add test for when filename is missing [#24] 2 months ago
config Add test config 2 months ago
lib whitespace 2 months ago
routes `GET /jawns/recent` [#15] 2 months ago
test Add test for when filename is missing [#24] 2 months ago
views Last working bits of OAuth stuff 4 months ago
.editorconfig Initial commit 4 months ago
.gitignore Add logging framework [#12] 4 months ago
.npmrc Initial commit 4 months ago
.nvmrc upgrade to 12.17 3 months ago
LICENSE Initial commit 4 months ago
README.md some notes in README 3 months ago
app.js `GET /jawns` [#16] 2 months ago
package-lock.json Add env-test 2 months ago
package.json Add env-test 2 months ago

README.md

jawn

ain’t no thing

notes on jawn data structure

so, you’re gonna have a single-level directory, with some number of files. each file has a name and some content. the order of files needs to be preserved, such that the data returned when you read a jawn has the files in the same order as when the jawn was created.

the big question: does the metadata drive everything or does the file layout on disk drive what’s in the metadata?

maybe the metadata file covers things like the jawn name and the file order and the file layout on disk powers the rest of the metadata?

lib/jawn.js library pseudocode/documentation

const jawn = new Jawn(path)

if (!path.exists) {
  mkdir path
}

set up object

jawn.delete()

rmdir(self.path)

reset object back to null

{metadata} = jawn._getMetadata();

get metafile name
metadata = readFile(metafileName);

[{name,data},{name,data}] = jawn.read();

jawn.update([{name,data}, {name,data}, ...]);

metafileName = get metafile name
metadata = <empty metadata struct>
foreach (fileStruct of files) {
  if (fileStruct.name === metafileName) {
    metafileName = get new metafile name
  }
  this.meta.files.push(fileStruct.name)
  fs.write(fileStruct.name, fileStruct.data)
}
writeMeta(metafileName, metadata)