New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@freearhey/core

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@freearhey/core - npm Package Compare versions

Comparing version

to
0.3.0

2

package.json
{
"name": "@freearhey/core",
"version": "0.2.2",
"version": "0.3.0",
"description": "Toolset for Node.js",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -8,3 +8,3 @@ import * as path from 'path'

constructor(filepath: string, content?: string) {
this._filepath = path.normalize(filepath)
this._filepath = path.resolve(path.normalize(filepath))
this._content = content || ''

@@ -11,0 +11,0 @@ }

@@ -10,3 +10,3 @@ import { File } from './'

constructor(rootDir?: string) {
this._rootDir = path.normalize(rootDir || './')
this._rootDir = path.resolve(path.normalize(rootDir || process.cwd()))
}

@@ -94,7 +94,10 @@

async saveSync(filepath: string, content: any): Promise<void> {
await this._writeSync(filepath, content)
this._writeSync(filepath, content)
}
async saveFile(file: File): Promise<void> {
await this._write(file.path(), file.content())
const dir = path.dirname(file.path())
await this.createDir(dir)
await fs.writeFile(file.path(), file.content(), { encoding: 'utf8', flag: 'w' })
}

@@ -101,0 +104,0 @@

import { File } from '../src'
import * as path from 'path'

@@ -7,3 +8,3 @@ describe('file', () => {

expect(file._filepath).toEqual('folder/example.txt')
expect(file._filepath).toEqual(path.resolve('./folder/example.txt'))
expect(file._content).toEqual('')

@@ -15,3 +16,3 @@ })

expect(file._filepath).toEqual('folder/example.txt')
expect(file._filepath).toEqual(path.resolve('./folder/example.txt'))
expect(file._content).toEqual('abc')

@@ -29,3 +30,3 @@ })

expect(file.dirname()).toEqual('folder')
expect(file.dirname()).toEqual(path.resolve('./folder'))
})

@@ -42,3 +43,3 @@

expect(file.path()).toEqual('folder/example.txt')
expect(file.path()).toEqual(path.resolve('./folder/example.txt'))
})

@@ -45,0 +46,0 @@

@@ -12,3 +12,3 @@ import { Storage, File } from '../src'

expect(storage._rootDir).toEqual('./')
expect(storage._rootDir).toEqual(path.resolve('./'))
})

@@ -19,3 +19,3 @@

expect(storage._rootDir).toEqual('test')
expect(storage._rootDir).toEqual(path.resolve('./test'))
})

@@ -103,4 +103,4 @@

fs.emptyDirSync(OUTPUT_DIR)
const storage = new Storage(OUTPUT_DIR)
const file = new File('e.txt', 'e')
const storage = new Storage()
const file = new File(`${OUTPUT_DIR}/e.txt`, 'e')

@@ -107,0 +107,0 @@ await storage.saveFile(file)