refactor chunk file API